添加自定义手势识别:TapGesture

1.确认userInteractionEnabled = YES
2.确认添加了
3.添加代码:

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapResign)];
    [backgroundImageView addGestureRecognizer:tap];
    backgroundImageView.userInteractionEnabled = YES;

    tap.numberOfTapsRequired = 1;
4.OK!


评论

此博客中的热门博文

使__attribute__((annotate("xxx")))能作用于OC函数

viewWillAppear不执行的解决办法

iOS中使用xpc/xpc.h