V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
liuxu0718
V2EX  ›  iDev

跪求 tableView 手势冲突的解决方案

  •  
  •   liuxu0718 · 2015-01-23 15:06:38 +08:00 · 2924 次点击
    这是一个创建于 3374 天前的主题,其中的信息可能已经有所发展或是发生改变。
    使用了一个抽屉的三方(YRSideViewController), 抽屉的侧拉手势 和 tableView的侧拉删除cell的手势冲突。 其实就是想实现类似于手机QQ主面板的效果,侧拉能出抽屉,在聊天信息框中也能侧拉删除一个会话。 跪求各路大神帮忙,谢谢!
    3 条回复    2015-01-23 21:56:55 +08:00
    liuxu0718
        1
    liuxu0718  
    OP
       2015-01-23 15:41:14 +08:00
    方案已找到。在YRSideViewController里加入如下代码即可。
    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
    {
    // 输出点击的view的类名
    NSLog(@"%@", NSStringFromClass([touch.view class]));

    // 若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件
    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
    return NO;
    }
    return YES;
    }
    qiyu
        2
    qiyu  
       2015-01-23 16:41:09 +08:00
    手势冲突的时候,也可以看一下requireGestureRecognizerToFail
    liuxu0718
        3
    liuxu0718  
    OP
       2015-01-23 21:56:55 +08:00
    @qiyu 好的 3q
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1091 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 23:14 · PVG 07:14 · LAX 16:14 · JFK 19:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.