gpt4 book ai didi

python - Pythonista:如何显示UIAlertController?

转载 作者:行者123 更新时间:2023-12-01 16:26:21 24 4
gpt4 key购买 nike

我正在处理一个Pythonista脚本,该脚本显示UITabBarController,其中包含多个UINavigationController,其中包含UITableViewController。在某个时候,我需要显示一个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

在此先感谢您的帮助。

最佳答案

原来的问题是我试图在iPad上显示操作表而不设置popoverPresentationController

关于python - Pythonista:如何显示UIAlertController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35074897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com