草庐IT

AlertController

全部标签

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 - 以编程方式切换 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:"

xcode - Swift UIAlertController 获取文本字段文本

我需要在按下“输入”按钮时从警报View中的文本字段中获取文本。funcinputMsg(){varpoints=""varoutOf=""varalertController=UIAlertController(title:"InputView",message:"PleaseInputYourGrade",preferredStyle:UIAlertControllerStyle.Alert)letactionCancle=UIAlertAction(title:"Cancle",style:UIAlertActionStyle.Cancel){ACTIONinprintln("C

ios - 在 iPhone 上的弹出窗口中呈现 UIAlertController ActionSheet

我正在创建并呈现一个ActionSheet,如下所示:letalertController=UIAlertController(title:nil,message:nil,preferredStyle:.ActionSheet)alertController.modalPresentationStyle=.Popover//AddsomebuttonsalertController.popoverPresentationController?.delegate=selfalertController.popoverPresentationController?.barButtonIte

ios - 在 iPhone 上的弹出窗口中呈现 UIAlertController ActionSheet

我正在创建并呈现一个ActionSheet,如下所示:letalertController=UIAlertController(title:nil,message:nil,preferredStyle:.ActionSheet)alertController.modalPresentationStyle=.Popover//AddsomebuttonsalertController.popoverPresentationController?.delegate=selfalertController.popoverPresentationController?.barButtonIte

ios - 如何同时关闭 UIAlertController 和键盘?

我用UIAlertController创建了一个注册表单,并使用方法addTextFieldWithConfigurationHandler添加了一个文本字段。但是有一个小问题。当表单出现时,键盘和模态框会出现一个流畅的动画。关闭表单时,模态框先消失,然后键盘消失。这使得键盘突然向下坠落。如何让模态框和键盘优雅地消失?lazyvaralertController:UIAlertController={[weakself]inletalert=UIAlertController(title:"Alert",message:"Thisisademoalert",preferredStyle

ios - 如何同时关闭 UIAlertController 和键盘?

我用UIAlertController创建了一个注册表单,并使用方法addTextFieldWithConfigurationHandler添加了一个文本字段。但是有一个小问题。当表单出现时,键盘和模态框会出现一个流畅的动画。关闭表单时,模态框先消失,然后键盘消失。这使得键盘突然向下坠落。如何让模态框和键盘优雅地消失?lazyvaralertController:UIAlertController={[weakself]inletalert=UIAlertController(title:"Alert",message:"Thisisademoalert",preferredStyle

ios - 替代 iOS 9 的 UIAlertView?

UAlertView在iOS9及更高版本中已弃用。有什么替代方案?UIAlertView*new=[[UIAlertViewalloc]initWithTitle:@"Success"message:@"YourInAppPurchasesweresuccessfullyrestored"delegate:nilcancelButtonTitle:@"OK"otherButtonTitles:nil];[newshow]; 最佳答案 您可以使用此代码替换警报View:UIAlertController*alertController

ios - 替代 iOS 9 的 UIAlertView?

UAlertView在iOS9及更高版本中已弃用。有什么替代方案?UIAlertView*new=[[UIAlertViewalloc]initWithTitle:@"Success"message:@"YourInAppPurchasesweresuccessfullyrestored"delegate:nilcancelButtonTitle:@"OK"otherButtonTitles:nil];[newshow]; 最佳答案 您可以使用此代码替换警报View:UIAlertController*alertController