草庐IT

UIAlertcontroller

全部标签

ios - UIAlertController -- 在此 block 中强烈捕获 'controller'

UIAlertController崩溃并显示此错误消息:Attemptingtoloadtheviewofaviewcontrollerwhileitisdeallocatingisnotallowedandmayresultinundefinedbehavior()trycatchtextFieldsobjectAtIndex时也会抛出警告。有什么想法吗?Warning..Capturing'controller'stronglyinthisblockislikelytoleadtoaretailcycle.我还尝试创建一个@property(weak)引用警告消失但应用程序仍然崩溃

ios - 当键盘存在时,使用 UITextView 向上移动 UIAlertController 样式警报

我有一个带有UITextView的AlertController。当UITexView成为第一响应者时,alter不会随着键盘向上移动。这是我的代码:@IBActionfuncshowAlert(sender:AnyObject){letalertController=UIAlertController(title:"Hello,I'malert!\n\n\n\n\n\n\n",message:"",preferredStyle:.alert)letrect=CGRect(x:15,y:15,width:240,height:150)//CGRectMake(15,50,240,150

iOS 9.0 - 从 UIAlertController 操作表中删除顶部栏

在使用UIAlertController创建操作表时,我看到顶部栏始终显示。ThisSOpost建议将标题设置为nil-这可能适用于iOS8.0,但我在iOS9.0上看到顶部栏。 最佳答案 同时将message设置为nil:UIAlertController*actionSheet=[UIAlertControlleralertControllerWithTitle:nilmessage:nilpreferredStyle:UIAlertControllerStyleActionSheet];UIAlertAction*action

ios - UIAlertController 标题中的倒计时 NSTimer 获取空值而不是时间(以秒为单位)

我试图在UIAlertController的标题中显示倒计时。我想要类似“您的session将在X秒后到期”的内容。我的想法是创建一个NSTimer并将时间存储在NSStringstringWithFormat中,并将该字符串作为警报Controller的标题。这是我的倒计时方法:@interfaceViewController(){NSString*seconds;intmainInt;NSTimer*timer;}-(void)countDown{mainInt=20;mainInt-=1;seconds=[NSStringstringWithFormat:@"%i",mainIn

ios - UIAlertController 中的自定义 View

我正在尝试将自定义View放入UIAlertController中。我在自定义View的大小方面遇到了一些奇怪的问题。我希望自定义View跨越UIAlertController的宽度,无论它是什么。我正在使用CGRectGetWidth(alertController.view.bounds)获取警报Controller的宽度。但是,这似乎是返回整个View的宽度。使用view.frame没有任何区别。UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:@"MyTitle"messag

ios - 如何在 ObjC 中普遍更改 UIAlertController 按钮颜色

这个问题类似于this但是,我不想更改每个UIAlertController中的颜色,而是想像“AppDelegate”一样更改它的通用颜色。所以,如果我在一个地方更改颜色,那么所有警报Controller操作按钮都应更改为新颜色。我的问题是:是否可以通过AppDelegate完成?如果没有,我该怎么做?Apple会批准在所有iOS版本中将按钮颜色更改为自定义颜色吗? 最佳答案 是的,这是可能的。在AppDelegate中添加以下行,所有UIAlertControllers都将设置色调颜色![[UIViewappearanceWhe

ios - 我如何显示来自任何 NSObject 子类的 UIAlertController?

我有一个正在管理的遗留代码库,它需要显示来自各个地方的警报消息。这是一种糟糕的做法,需要重构,但这不会很快发生。在iOS9中,我需要能够触发和忘记警报View,并为我管理View显示和排队。 最佳答案 为了显示,UIAlertController,我们需要UIViewController的对象,所以您可以使用下面的方法来做到这一点。UIWindow*keyWindow=[[UIApplicationsharedApplication]keyWindow];UIViewController*mainController=[keyWin

ios - 如何在应用程序委托(delegate) (obj-c) 中添加 UIAlertController

这是我在弃用UIAlertView之前使用的代码://OLDUIALERTVIEW-(void)applicationDidBecomeActive:(UIApplication*)application{//Restartanytasksthatwerepaused(ornotyetstarted)whiletheapplicationwasinactive.Iftheapplicationwaspreviouslyinthebackground,optionallyrefreshtheuserinterface.//checktoseeifnewerversionexiststoa

ios - 我们可以从没有像 "Action Extension"这样的用户界面的应用程序扩展中显示 UIAlertController 吗?

我正在为没有用户界面的iOS开发应用程序扩展。对于它的功能,我不需要任何用户界面,因为所有任务都在后台完成。唯一需要UI的场景是在设备缺少某些配置时提醒用户。我可以从这样的扩展中显示UIAlertController还是必须配置扩展才能使用用户界面? 最佳答案 当我使用需要类似“popUp”效果但由于某种原因不能使用UIAlertController的东西时,我使用thisSDK它真的很好,文档也很完整。 关于ios-我们可以从没有像"ActionExtension"这样的用户界面的应用

ios - UIActionSheet 与 UIAlertController - iPad

我们必须在iOS8中使用UIAlertController还是仍然可以使用UIActionSheet?我不希望为了iOS8的兼容性而对我们的代码进行大量更改,但我在iPad上使用UIActionSheet时遇到了几个问题。例如,我在使用UIActionSheet时遇到此异常:UIPopoverPresentationController()shouldhaveanon-nilsourceVieworbarButtonItemsetbeforethepresentationoccurs.我知道最好使用新的UIAlertController,但是是否有任何解决方法可以继续使用UIActio