我正在考虑创建一个具有通知中心扩展的 iOS 应用程序。但是我需要我的应用程序在通知中心内的扩展上使用 3D Touch,这可能吗?
最佳答案
据我所知,你不能。从苹果文档来看,该功能似乎仅在应用程序和主屏幕上可用:
A user can now press your Home screen icon to immediately access functionality provided by your app. Within your app, a user can now press views to see previews of additional content and gain accelerated access to features.
为了实验的缘故,尝试使用 touch ID 注册 View Controller
override func viewDidLoad() {
if( traitCollection.forceTouchCapability == .Available){
registerForPreviewingWithDelegate(self, sourceView: view)
}
}
你会得到一个错误,因为 TodayViewController 不符合这些协议(protocol)。这可能是将来要添加的内容,但目前看起来不受支持,很可能是因为 “今日小工具”要尽可能简单。
编辑:从 iOS 10 开始,这不仅是可能的,而且是小部件中的首选功能。标准文档将告诉您如何实现。
关于ios - 你可以在小部件上使用 3D Touch 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36732641/