草庐IT

uialertController

全部标签

ios - 在 UIAlertController 中按下返回按钮

我正在尝试将UIAlertController用于多种用途。它有两个按钮,取消和确定。我想将它添加到一个方法中并返回按钮按下,这样我就可以检查用户的响应并对其进行操作。现在,我无法在block中返回值。那么,我该怎么做呢?谢谢。UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:NSLocalizedString(@"Atenção!","Atenção!")message:NSLocalizedString(@"Vocênãofinalizouasuasérie.Sesairdest

ios - UIAlertController EXC_BAD_ACCESS 错误 - Swift

我正在尝试在Swift中使用UIAlertController和iOS7,当警报出现时我不断收到以下错误:EXC_BAD_ACCESS(代码=1,地址=0x10)这是警报的代码。varalert:UIAlertController=UIAlertController(title:"Ooops",message:"PleaseFillInEverything",preferredStyle:UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title:"OK",style:UIAlertActionStyle.Defau

ios - 如何在 Swift 的 UIAlertController 中更改 UITextField 的高度?

我在UIAlertController中添加了一个UITextField。我想更改文本字段的高度。我试过这种方式:letalertController=UIAlertController(title:"Comments",message:"Writeyourcommentshere",preferredStyle:UIAlertControllerStyle.alert)alertController.addTextField{(textField:UITextField)->Voidinvarframe:CGRect=textField.frameframe.size.height=

ios - 如何更改 UIAlertController 的色调?

我可以更改UIAlertController的颜色吗?标准颜色是蓝色。而且它非常接近标准的iOS应用程序。如果可以定制呢?我怎样才能改变这个的颜色?例如按钮颜色。谢谢! 最佳答案 您可以只更改底层View的tintColor,但是,由于iOS9中引入的已知错误(https://openradar.appspot.com/22209332),tintColor会被应用程序窗口的tintColor覆盖。您可以:在AppDelegate中更改应用tintColor。funcapplication(application:UIApplica

ios - 在呈现期间更改 UIAlertController 消息或标题

UIAlertController正在显示时,可以更改UIAlertController的标题或消息文本。例如,当用户按下带有此消息的按钮时,我会显示一个警报:“等待兑换码”然后我使用Alamofire发出请求并获取代码,在我拥有它之后我想将消息从警报更改为不关闭并再次呈现它,例如新的消息文本就是它:“您的兑换码是:########”已更新这是我的代码:@IBActionfuncofferAction(_sender:UIButton){varcode:String="Generatingcóde"letmessage:String="Elcódigopararedimirestaof

ios - 当用户使用 swift 键入时,限制 UIAlertController 中文本字段的输入?

我找到了关于如何为UIAlertController添加文本字段的示例代码但我无法限制用户仅输入10个字符,因为一个限制,当对常规文本字段进行编辑更改但无法检查UIAlertController上的文本字段时,我有一个函数可以在结束时删除最后一个字符。//FunctiontoRemovethelastcharacterfunctrimStr(existStr:String)->String{varcountExistTextChar=countElements(existStr)ifcountExistTextChar>10{varnewStr=""newStr=existStr.su

ios - 尝试在已经呈现的 View Controller 上呈现 UIAlertController(空)[Swift]

我有一个警告View,我正试图在照片View上呈现。照片显示在列表中,可以推送到全屏View。照片View正在以编程方式显示。我认为这就是导致问题的原因,因为警报View试图在已经呈现的(照片)View之上呈现另一个View。警报View正在尝试显示,但出现此错误:Warning:Attempttopresentonwhichisalreadypresenting(null)可能有问题的是这一行:self.present(textPrompt,animated:true,completion:nil)这是主ListView这是截图时的主ListView这是主照片View这是主照片Vie

swift - 以编程方式触发 UIAlertController 上的 UIAlertAction?

关于这个主题有几个现有的问题,但它们并不是我想要的。我为我的应用程序编写了一个Swift应用程序评级小提示,其中显示两个UIAlertController实例,一个由另一个触发。我现在正尝试对此进行单元测试,并尝试在测试中达到第二个警报。我已经编写了一个简单的spy程序来检查第一个Controller,但我想要一种方法来触发第一个警报中的一个操作,然后显示第二个警报。我已经试过了alert.actions.first?.accessibilityActivate(),但它似乎并没有破坏该操作的处理程序-这就是我所追求的。 最佳答案

ios - LAContext 更改 UIAlertController 按钮标题

我已经使用LAContext将TouchID整合到我的应用程序中,如下所示:但是,我想将按钮标题的名称从“输入密码”更改为输入“输入安全代码”(或类似的名称),如下所示:我将如何更改该按钮标题?这是LAContextdocumentation这是我的代码:vartouchIDContext=LAContext()iftouchIDContext.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics,error:&msgError){touchIDContext.evaluatePolicy(.DeviceO

ios - self.navigationController?.popViewControllerAnimated 来自 UIAlertController

我是swift的新手,但我想我已经掌握了窍门。不过,这严重阻碍了我的进步。我想做的是当我们找不到与他的查询相关的数据时,向用户抛出一个错误信息,然后继续将他带回之前的ViewController。但是,我在执行此操作时遇到了真正的麻烦。在我添加操作的行中,出现以下错误:“UIViewController?”不是Void的子类型letalertController=UIAlertController(title:"Oops",message:"Wecouldn'tfindanydataforthistitle,sorry!",preferredStyle:UIAlertControlle