最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ios觸屏事件指南

 更新時間:2015年05月27日 11:51:11   投稿:hebedich  
這篇文章主要給大家總結(jié)介紹了2種實現(xiàn)ios觸屏事件的方法,簡單實用,有需要的小伙伴可以參考下。

復(fù)制代碼 代碼如下:

//在一個函數(shù)里面(初始化等)里面添加要識別觸摸事件的范圍
    infoView=[[UIView alloc] initWithFrame:CGRectMake(20, 100,220, 280)];//范圍,出了這個范圍就檢測不到觸摸了
    infoView.backgroundColor=[UIColor blueColor];
    infoView.alpha=0.6;
    [self.view addSubview:infoView];
    /******************監(jiān)視手勢控制*****************///有上下左右,我只用到了左右,上下注掉了。
    UISwipeGestureRecognizer *recognizer;
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
    [infoView addGestureRecognizer:recognizer];
//    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
//    [recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];
//    [self.view addGestureRecognizer:recognizer];
//    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
//    [recognizer setDirection:(UISwipeGestureRecognizerDirectionDown)];
//    [self.view addGestureRecognizer:recognizer];
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
    [infoView addGestureRecognizer:recognizer];
//觸摸事件 的實現(xiàn)函數(shù)
//滑動事件1
-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer{
    //如果往左滑
    if(recognizer.direction==UISwipeGestureRecognizerDirectionLeft) {
        NSLog(@"****************向左滑****************");
    }
    //如果往右滑
    if(recognizer.direction==UISwipeGestureRecognizerDirectionRight) {
        NSLog(@"****************向右滑****************");      
    }
   if (recognizer.direction==UISwipeGestureRecognizerDirectionDown){
       NSLog(@"****************向下滑****************");
    }
    if (recognizer.direction==UISwipeGestureRecognizerDirectionUp){
      NSLog(@"****************向上滑****************");
   }
}

方法二:

復(fù)制代碼 代碼如下:

GSEventRecord header;    
GSHardwareKeyInfo key = {0,0,0,0,1,{'a'},1,{'a'},0,0,0,0};    
memset(&header, 0, sizeof(header));    
header.type = kGSEventKeyDown;    
header.infoSize = sizeof(GSHardwareKeyInfo);    
header.timestamp = mach_absolute_time();    
struct    
{    
    GSEventRecord header1;    
    GSHardwareKeyInfo key1;    
}fuck = {header, key};    
GSSendEvent(&fuck, GSGetPurpleApplicationPort());   
    GSEventRecord header; 
    GSHardwareKeyInfo key = {0,0,0,0,1,{'a'},1,{'a'},0,0,0,0}; 
    memset(&header, 0, sizeof(header)); 
    header.type = kGSEventKeyDown; 
    header.infoSize = sizeof(GSHardwareKeyInfo); 
    header.timestamp = mach_absolute_time(); 
    struct 
    { 
        GSEventRecord header1; 
        GSHardwareKeyInfo key1; 
    }fuck = {header, key}; 
    GSSendEvent(&fuck, GSGetPurpleApplicationPort());

以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡。

相關(guān)文章

最新評論

太仓市| 含山县| 柯坪县| 铜梁县| 广元市| 弥渡县| 双牌县| 诏安县| 郎溪县| 屏边| 尼玛县| 庆阳市| 平江县| 汕头市| 灵石县| 丰城市| 盖州市| 通渭县| 象山县| 射洪县| 汉寿县| 盐源县| 绥江县| 罗源县| 怀化市| 松滋市| 黄冈市| 长寿区| 陆河县| 兴义市| 汤阴县| 临颍县| 寿阳县| 巫溪县| 盱眙县| 穆棱市| 巴林左旗| 新泰市| 肃宁县| 丰原市| 丰城市|