手势处理 ios

来源:互联网 时间:2017-01-22

   UIWindow *window = [[UIApplicationsharedApplication].windowslastObject];


     UITapGestureRecognizer * singleRecognizer = [[UITapGestureRecognizeralloc] initWithTarget:selfaction:@selector(SingleTap:)];

        //点击的次数

        singleRecognizer.numberOfTapsRequired =1; // 单击

        

        //给self.view添加一个手势监测;

        

        [self.windowImageViewaddGestureRecognizer:singleRecognizer];


-(void)SingleTap:(UITapGestureRecognizer*)recognizer

{

    //处理单击操作

    [[NSUserDefaultsstandardUserDefaults] setObject:@"YES"forKey:@"isFistTime"];

    [self.windowImageViewremoveFromSuperview];

}

相关阅读:
Top