swift – 在tvOS 10 GM上打开UIAlertController时焦点消失了
我想在UIViewController上面显示一个UIAlertController,里面有一个UICollectionView.集合视图需要专注于启动,所以我覆盖了preferredFocusableView变量,如下所示:
override var preferredFocusedView: UIView? { return self.collectionView } 使用tvOS 9一切正常:警报控制器正常打开,我可以选择其中一个显示的UIAlertActions. 在tvOS 10 Golden Master上,打开警报控制器并滚动到另一个动作后,焦点从屏幕上消失,我无法滚动到其他操作或点击Siri遥控器的菜单按钮.该应用程序仍然卡在警报控制器中,当我尝试滚动到其他操作但屏幕上没有任何操作时,我可以听到滚动声音.我必须强制退出应用程序并重新打开它. 这是应用程序的代码.我尝试将preferredFocusableView设置为alertController.preferredFocusedView,或者删除集合视图的焦点方法但没有结果. var alertController : UIAlertController? func showAlert() { alertController = UIAlertController(title:"Example title",message: "Example description",preferredStyle: .Alert) let action1 = UIAlertAction(title: "Option 1",style: .Default) { (action : UIAlertAction) -> Void in //call to another method } // action2,action3,action4... let action5 = UIAlertAction(title: "Option 5",style: .Default) { (action : UIAlertAction) -> Void in //call to another method } let actionDismiss = UIAlertAction(title: "Dismiss",style: .Destructive) { (action : UIAlertAction) -> Void in self.alertController!.dismissViewControllerAnimated(true,completion: nil) } alertController!.addAction(action1) alertController!.addAction(action2) alertController!.addAction(action3) alertController!.addAction(action4) alertController!.addAction(action5) alertController!.addAction(actionDismiss) alertController!.preferredAction = action1 self.presentViewController(alertController!,animated: true,completion: nil) } override var preferredFocusedView: UIView? { if self.alertController != nil { return self.alertController!.preferredFocusedView } else { return self.collectionView } } 解决方法
Apple只是回复了我的雷达:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |