问题描述
我在 Today 小部件中使用了 UIView 子类.该视图使用滑动手势.但是,这些手势要么上下滚动整个通知中心,要么让通知中心从 Today 切换到 Notifications.
有什么方法可以防止触摸事件冒泡到通知中心滚动视图?在子类中使用[self setExclusiveTouch:YES];并没有解决,很遗憾.
有什么方法可以防止触摸事件冒泡到通知中心滚动视图?使用 [self setExclusiveTouch:YES];不幸的是子类中没有解决.
没有.由于您的 Today 小部件在内部呈现远程视图托管,[self setExclusiveTouch:YES] 并不能完全满足您的需求.
iOS 8.0 中的粗略架构是:
<上一页>[用户触摸创建一个UITouch]|v通知中心(UIScrollView)|vUIRemoteView 容器(呈现你的 UIView)[跨越流程边界]|v你的 Today 小部件的 UIView当触摸越过进程边界时,就可以认为它基本上是被克隆的.您的视图的专有触摸需求仅与您的小部件的进程空间/窗口相关,并且不会向外传播到远程托管您的通知中心.
I'm using a UIView subclass in my Today widget. The view makes use of swiping gestures. However, these gestures either scroll the whole Notification Center up and down, or make the Notification Center switch from Today to Notifications.
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.
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.
No. Because of the remote view hosting that your Today widget is being presented inside, [self setExclusiveTouch:YES] doesn't quite do what you want.
The rough architecture in iOS 8.0 is:
[User touch creates a UITouch]
|
v
Notification Center (UIScrollView)
|
v
UIRemoteView container
(presents your UIView)
[crosses process boundary]
|
v
your Today widget's UIView
Think of the touch as basically becoming cloned when it crosses the process boundary. Your view's exclusive touch desires are only relevant in your widget's process space/window, and don't propagate back outwards to the Notification Center which is hosting you remotely.
这篇关于在 iOS 8 Today Extensions 中拖动手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)