iOS笔记之UITapGestureRecognizer

使用 UITapGestureRecognizer ,创建一个 UITapGestureRecognizer 将它添加到view上即可

UIView *tapView=[[UIView alloc]initWithFrame:SCREEN_FRAME];
 
UITapGestureRecognizer *tapGesturRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
[tapView addGestureRecognizer:tapGesturRecognizer];


-(void)tapAction:(id)tap {
    NSLog(@"点击了tapView");
}

你可能感兴趣的:(iOS笔记之UITapGestureRecognizer)