我正在编写一个Pythonista脚本,该脚本显示一个UITabBarController,其中包含多个UINavigationControllers,其中包含UITableViewControllers。有时我需要显示一个UIAlertController,但我尝试呈现的所有方法要么使应用程序崩溃,要么将UIAlertController推送到导航堆栈。
我的代码:
from objc_util import *
from UIKit import *
alert = UIAlertController.alertControllerWithTitle_message_preferredStyle_('Title', 'Message', 0)
def alertActionCancel(sender):
print 'Cancelled!'
alertActionCancelBlock = ObjCBlock(alertActionCancel, None, [c_void_p])
retain_global(alertActionCancelBlock)
alert.addAction_(UIAlertAction.actionWithTitle_style_handler_('Cancel', 1, alertActionCancelBlock))
myTableViewController.presentViewController_animated_completion_(alert, True, None) # This line crashes Pythonista提前感谢,任何帮助都是非常感谢的。
发布于 2016-01-31 08:19:59
事实证明,问题是我试图在没有设置popoverPresentationController的情况下在iPad上演示操作说明书。
https://stackoverflow.com/questions/35074897
复制相似问题