我在我的 Today 小部件中使用 UIView
子类。该 View 使用滑动手势。然而,这些手势要么上下滚动整个通知中心,要么使通知中心从今天切换到通知。
有什么方法可以防止触摸事件冒泡到通知中心 ScrollView 吗?不幸的是,在子类中使用[self setExclusiveTouch:YES];
没有解决。
最佳答案
Is there any way to prevent the touch events to be bubbled up to the Notification Center scroll view? Using [self setExclusiveTouch:YES]; in the subclass did not solve it unfortunately.
没有。由于您的 Today 小部件在内部呈现的远程 View 托管,[self setExclusiveTouch:YES]
并没有完全按照您的意愿进行。
iOS 8.0 中的粗略架构是:
[User touch creates a UITouch] | v Notification Center (UIScrollView) | v UIRemoteView container (presents your UIView) [crosses process boundary] | v your Today widget's UIView
将触摸视为在跨越进程边界时基本上被克隆。您的 View 的独有触摸需求仅与您的小部件的进程空间/窗口相关,并且不会向外传播回远程托管您的通知中心。
关于ios - iOS 8 Today 扩展中的拖动手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24563472/