草庐IT

uialertController

全部标签

ios - 警告 : UIAlertController is already presenting

我是swift和XCode的新手所以请原谅我可能真的很乱的代码!运行我的代码时,我收到以下警告:警告:尝试在已经呈现的上呈现我已经查看了论坛并找到了关于该问题的帖子....我应用了建议的帮助,如下所示:ifpresentedViewController!==nil{self.presentViewController(alertController,animated:true,completion:nil)}else{self.dismissViewControllerAnimated(false,completion:nil)self.presentViewController(al

iOS 8 只有内存泄漏与 UIAlertController 或 UIActionSheet

当我使用UIActionSheet或UIAlertController执行以下操作时,我在模拟器中的iOS8中看到内存泄漏。UIActionSheet在IOS8中使用UIAlertController,因此问题是相关的。按下按钮时调用showCameraAction。我已经从委托(delegate)方法中删除了所有内容,但仍然会在下面显示的情况下泄漏。我是否以某种不应该的方式使用了UIActionSheet?对于解决此问题的任何帮助,我将不胜感激。相同的代码在IOS7中没有泄漏(在模拟器中)。-(IBAction)showCameraAction:(id)sender{UIAction

ios - UIAlertController 根本没有出现

我正在尝试将UIAlertController添加到我的应用程序,但它根本没有出现。我尝试了以下方法:UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:@"Message"message:@"WebServiceisnotavailable."preferredStyle:UIAlertControllerStyleAlert];UIAlertAction*ok=[UIAlertActionactionWithTitle:@"OK"style:UIAlertActionStyleDe

ios - 仅在验证输入后启用 UIAlertController 的 UIAlertAction

我正在使用UIAlertController显示一个对话框,其中包含一个UITextField和一个标记为“Ok”的UIAlertAction按钮。在UITextField中输入多个字符(例如5个字符)之前,如何禁用该按钮? 最佳答案 您可以将观察者添加到您的UITextField:[alertControlleraddTextFieldWithConfigurationHandler:^(UITextField*textField){[textFieldaddTarget:selfaction:@selector(alertCon

ios - 如何在 IOS 9 的 UIAlertController 中添加按钮

我们如何在iOS9中使用UIAlertView以及如何在UIAlertController中添加按钮UIAlertController*alert=[UIAlertControlleralertControllerWithTitle:@"Title"message:@"Message"preferredStyle:UIAlertControllerStyleAlert];UIAlertAction*yesButton=[UIAlertActionactionWithTitle:@"Yes,please"style:UIAlertActionStyleDefaulthandler:^(U

ios - 如何使用 UITableView 自定义 UIAlertController 或者是否有像 Pages 应用程序中的这个 UI 这样的默认控件可用?

我想像这样实现一个UIAlertViewController(引用:Pages和Keynote应用程序):.我已经实现了一个自定义的tableview并通过模仿UIAlertViewController来呈现View。但是我无法实现与上面类似的用户界面。是否有任何默认Controller可用于此?-(void)share:(id)sender{[selfsetModalPresentationStyle:UIModalPresentationCurrentContext];AlertViewController*renameCntrl=[self.storyboardinstantia

尝试添加文本字段时 iOS 8.3 UIAlertController 崩溃

我有一个iPad应用程序。我正在创建一个UIAlertController并添加一个文本字段。它崩溃了。它仅在我添加文本字段时崩溃。letalert=UIAlertController(title:"EnterName",message:nil,preferredStyle:UIAlertControllerStyle.Alert);alert.addTextFieldWithConfigurationHandler{(textfield:UITextField!)->Voidintextfield.placeholder="Sexytime";}alert.addAction(UIA

ios - UIAlertController 泄漏

我通过使用以下方法在UIViewController上创建类别,在我的应用程序中添加了UIAlertController:-(void)showAlertViewWithTitle:(NSString*)titlemessage:(NSString*)messageactions:(NSArray*)alertActions{UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:title?:@""message:messagepreferredStyle:UIAlertControll

ios - 如何在 iOS9 中更改 UIAlertController 按钮文本颜色?

问题类似于iOS8UIActivityViewControllerandUIAlertControllerbuttontextcoloruseswindow'stintColor但在iOS9中。我有一个UIAlertController,即使我尝试设置,关闭按钮仍保持白色[[UIViewappearanceWhenContainedIn:[UIAlertControllerclass],nil]setTintColor:[UIColorblackColor]];UIAlertController*strongController=[UIAlertControlleralertContr

ios - UIAlertController 处理关闭点击外部 (iPad)

在iOS8之前,我们使用UIActionSheet来显示警报,现在我们需要使用UIAlertController。当我们使用UIActionSheet时,我们可以通过比较clickedButtonAtIndex和cancelButtonIndex轻松处理用户在弹出窗口外单击的情况(这意味着他想取消操作)——如果用户确实在弹出窗口外按下,我们得到在此函数中取消按钮索引。我们如何使用新的UIAlertController处理这些情况?我尝试使用“完成”block,但它没有任何上下文。有没有简单的方法来处理这个?(除了“保存”一些通用变量中的Action状态)。