首页 > 其他 > 详细

UITableviewCell 点击事件与添加手势的冲突

时间:2015-12-12 11:03:36      阅读:259      评论:0      收藏:0      [点我收藏+]

#pragma mark - 添加手势隐藏键盘

- (void)tabBackground

{

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnce)];

    tap.delegate = self;

    

    [tap setNumberOfTouchesRequired:1];

    [self.view addGestureRecognizer:tap];

    

}

 

- (void)tapOnce

{

    [self.textField resignFirstResponder];

}

 

#pragma mark - UIGestureRecognizerDelegate

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

{

    LXLog(@"%@",NSStringFromClass([touch.view class]));

    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {

        return NO;

    }

    return YES;

}

UITableviewCell 点击事件与添加手势的冲突

原文:http://www.cnblogs.com/TotoroLee/p/5040811.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!