码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-12-12 11:06:01      阅读:392      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!