草庐IT

UIAlertcontroller

全部标签

uitextfield - UIAlertController 的文本字段委托(delegate)未被调用

我已将UITextField添加到UIAlertController,但shouldChangeCharactersInRange不会被触发。为什么?我设置委托(delegate)。letalertController=UIAlertController(title:"",message:"xxx",preferredStyle:.Alert)self.presentViewController(alertController,animated:true,completion:nil)lettextField=UITextField()textField.delegate=selfal

ios - 是否可以横向旋转 UIAlertController(和 Alert)?

我正在编辑一个应用程序,我在其中添加了一个新的UIViewController以在一个布局中配置多人游戏。我为每个玩家添加了两个按钮(顶部按钮、机器人按钮)。每个按钮都会在屏幕上生成一个警报(记住它是横向的)但问题是,玩家2没有看到旋转的警报,我的意思是,警报应该以他的方向显示在我面前。有什么办法吗?我想为播放器2旋转一个警报,将看不到已转动警报的信息。这里是我的警报代码:@IBActionfuncShowAlert(){letmessage="Test"letalert=UIAlertController(title:title,message:message,preferredSt

ios - 从自定义类调用 presentViewController

我读了thispost和thisone关于如何在UIViewController子类之外调用presentViewController表单。在我的例子中,自定义类是NSObject的子类。以下方法是唯一有效的方法(来self阅读的示例):UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(alertController,animated:true,completion:nil)我的问题:是否有更好的解决方案不依赖于appDelegate(据我所知,这种方法在设计方面

ios - 以编程方式切换 UIAlert Controller

我正在用3个文本字段和一个开关快速创建一个注册对话框,我成功地添加了三个文本字段和两个警报。以下代码显示相同。letalertController=UIAlertController(title:"Register",message:"",preferredStyle:.Alert)letcancelAction=UIAlertAction(title:"Cancel",style:.Cancel){(action)in//...exit(0)}alertController.addAction(cancelAction)letOKAction=UIAlertAction(title:

ios - 在 swift 中显示 alertController 中的 textField

刚才我写了下面提供的代码。我想为以下代码生成输出,但是当我运行它时它崩溃了,并且它显示nil。classViewController:UIViewController,UITableViewDataSource{varnames=[String]()@IBOutletweakvartableView:UITableView!overridefuncviewDidLoad(){super.viewDidLoad()title="\"TheList\""tableView.registerClass(UITableViewCell.self,forCellReuseIdentifier:"

ios - 我如何检查另一个 View Controller 是否可见?

有时,当两个UIAlertViews试图同时显示时,我的应用程序会崩溃。如何在显示另一个UIAlertview之前检查是否正在显示另一个?这是我尝试过的方法,但它不起作用。注意:我在这个项目中使用swift。ifViewController.isVisable==false{self.presentViewController(AlertView,animated:true,completion:nil)} 最佳答案 作为对您问题的严格回应,您可以检查ViewController的View是否有他的窗口:ifViewControll

ios - UIAlertController - 如果第一次解除警报,则不会执行操作

在我正在进行的一个项目中,我必须编写一个UIAlert帮助程序模块,它可以在我的iOS应用程序中到处显示弹出窗口。弹出窗口被编写为类函数,我可以在代码中的任何地方简单地调用它们(类是静态的,所有函数也是静态的)。我现在遇到一个非常奇怪的错误,如果您关闭一次警报,然后再次打开它,它的操作将不再起作用(例如,不会调用操作处理程序)。如果您在第一次显示弹出窗口时单击该操作,它确实有效,但是......这是出现此错误的特定弹出窗口的代码(没有任何其他弹出窗口受到影响):staticfuncpopSkipWalkthrough(){letalert=UIAlertController(title

Swift 属性左预期编号列表

我正在使用下面的代码创建一个警报样式的规则列表UIAlertControllerletparagraphStyle=NSMutableParagraphStyle()paragraphStyle.alignment=NSTextAlignment.LeftletmessageText=NSMutableAttributedString(string:"1.Donotbullyortargetotherusers.\n2.Donotpostothers'privateinformation.\n3.Donotpostuselessoroffensivecontent.\n4.Donotp

ios - 如何在 SWIFT 中关闭没有任何操作的 UIAlertController?

我在下载图像时显示一个UIAlertController。下载完成后,我想推送一个ViewController。我在控制台中遇到错误,因为我没有关闭警报Controller:pushViewController:animated:calledonwhileanexistingtransitionorpresentationisoccurring;thenavigationstackwillnotbeupdated.在我的主视图Controller中,下载完成后,我推送另一个View:overridefunctableView(tableView:UITableView,didSelec

ios - UIAlertController - 更改文本字段的大小并在它们之间添加空格

我的警报看起来像这样:是否可以使输入更大并在它们之间增加空间?这是我的代码片段。我尝试更改第二个文本字段的frame属性,但没有帮助:letalert=UIAlertController(title:title,message:message,preferredStyle:.Alert)//Addthetextfieldsalert.addTextFieldWithConfigurationHandler({(textField)->VoidintextField.placeholder="Vašejméno"})alert.addTextFieldWithConfigurationH