草庐IT

uialertController

全部标签

ios - 使用 iOS 8 在 iPad 上正确呈现 UIAlertController

在iOS8.0中,Apple推出了UIAlertController替换UIActionSheet.不幸的是,Apple没有添加任何关于如何呈现它的信息。我找到了一个entryhayaGeek的博客上有关于它的介绍,但是它似乎在iPad上不起作用。该View完全放错了位置:错位:正确:我用下面的代码在界面上显示:letalert=UIAlertController()//settingbuttonsself.presentModalViewController(alert,animated:true)还有其他方法可以为iPad添加它吗?还是Apple只是忘记了iPad,或者尚未实现?

ios - 不在 View Controller 中时如何呈现 UIAlertController?

场景:用户点击ViewController上的按钮。ViewController是导航堆栈中最顶层的(显然)。tap调用在另一个类上调用的实用程序类方法。那里发生了一件坏事,我想在控制返回到ViewController之前在那里显示一个警报。+(void)myUtilityMethod{//dostuff//somethingbadhappened,displayanalert.}这可以通过UIAlertView实现(但可能不太合适)。在这种情况下,如何在myUtilityMethod中显示一个UIAlertController? 最佳答案

ios - 将图像添加到 UIAlertController

这是我的警报,效果很好。我想向警报添加一个图像,该图像在出现警报时显示在文本旁边,如果它有所不同,我在SpriteKit中的SKScene中。varalertController=UIAlertController(title:"HowtoSkate",message:"Tapthescreentoperformatrickandjumpovertheobsticles(Youcangrindonrails)Thegamewillendwhenyouhitahighlightedred,orangeoryellowobstacle.That'sit!+Image",preferredS

ios - UIAlertController : UICollectionViewFlowLayout is not defined warning every time I try to bringup a UIAlertcontroller

我正在使用UIAlertController获取用户输入并更新表格单元格。每次当我尝试创建警报时,我都会在控制台中收到以下警告2015-11-1917:51:42.034SimpleTableView[5488:584215]thebehavioroftheUICollectionViewFlowLayoutisnotdefinedbecause:2015-11-1917:51:42.035SimpleTableView[5488:584215]theitemheightmustbelessthantheheightoftheUICollectionViewminusthesectio

ios - 无法选择 UIAlertController 中的按钮顺序

我的印象是,如果在他们的UIAlertController中正常操作是破坏性操作,而另一个是取消操作,那么破坏性操作应该在左侧,而取消操作应该在右侧。如果正常Action不是破坏性的,那么正常Action应该在右边,取消应该在左边。也就是说,我有以下内容:varconfirmLeaveAlert=UIAlertController(title:"Leave",message:"Areyousureyouwanttoleave?",preferredStyle:.Alert)letleaveAction=UIAlertAction(title:"Leave",style:.Destruc

ios - UIAlertcontroller 设置属性消息

我们如何将UIAlertcontroller中的属性文本设置为消息。我的尝试代码如下所示,但它会使应用程序崩溃。//createAttributedtextletmyAttribute=[NSForegroundColorAttributeName:UIColor(red:122.0/255,green:125.0/255,blue:131.0/255,alpha:1.0),NSFontAttributeName:Constant.flinntRegularFont(15)]letmyAttribute2=[NSForegroundColorAttributeName:UIColor.

swift - 使用 preferredStyle : . ActionSheet 更改 UIAlertController 中取消按钮的颜色

是否可以将取消按钮的颜色更改为红色,我知道我们可以使用Destructive样式letcancelActionButton:UIAlertAction=UIAlertAction(title:"Cancel",style:.Destructive){action->Voidinprint("Cancel")}但我想要单独的取消按钮,像这样 最佳答案 letcancelAction=UIAlertAction(title:"Cancel",style:.cancel)cancelAction.setValue(UIColor.red,

ios - 在 ViewController 之外显示 UIAlertController

我无法显示我的UIAlertController,因为我试图在一个不是ViewController的类中显示它。我已经尝试添加它了:varalertController=UIAlertController(title:"Title",message:"Message",preferredStyle:.Alert)UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(alertController,animated:true,completion:nil)哪个不工作..

ios - 从 UITableViewCell 呈现 UIAlertController

我正在尝试向自定义UITableViewCell添加警报以呈现UIAlertView我需要从UIViewController调用presentViewController。但是,我不知道如何从UITableViewCell类访问当前的UIViewController实例。下面的代码是我尝试使用扩展来做到这一点。我收到这个错误Expressionresolvedtounusedfunction.extensionUIViewController{classfuncalertReminden(timeInterval:Int){varrefreshAlert=UIAlertControll

ios - 如何将 accessibilityIdentifier 设置为 UIAlertController?

这就是我如何简单地创建UIAlertController并将其显示在屏幕上:privateclassfuncshowAlertWithTitle(title:String,message:String){letalert=UIAlertController(title:title,message:message,preferredStyle:.Alert)//alert.accessibilityLabel="mystringhere"//doesntworkletaction=UIAlertAction(title:"OK",style:.Default){actioninalert