Dragging Gestures in iOS 8 Today Extensions(在 iOS 8 Today Extensions 中拖动手势)
问题描述
我在 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 中拖动手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 iOS 8 Today Extensions 中拖动手势
基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01