草庐IT

UIAlertcontroller

全部标签

ios - 如何在 Swift 中将日期选择器添加到 UIAlertController(UIAlertView)?

我有一个应用程序,我需要在其中显示一个弹出窗口以选择一个日期并将该日期写回ViewController。我在网上搜索了很多,但没有找到相关的解决方案。非常感谢任何形式的帮助。 最佳答案 不要使用任何类型的UIAlertView或UIAlertController。创建您的自己的View并将其弹出(可能使用呈现的ViewController)。View可以很小,就像一个日期选择器,你可以在它后面放一个阴影View,就像一个警报一样。 关于ios-如何在Swift中将日期选择器添加到UIAl

ios - 在 UIAlertController 中更改标题颜色

我有两个按钮,但我只想将其中一个变成红色。当我使用下面的功能时它全部变为红色。我只想改变一个按钮的颜色。我该怎么做?alertController.view.tintColor=UIColor.redColor() 最佳答案 letalertController=UIAlertController(title:title,message:message,preferredStyle:.actionSheet)alertController.setValue(NSAttributedString(string:title,attrib

swift - 如何从类内部调用 presentViewController

在我的完成处理程序中,我试图返回http响应代码,就像JS中的alert一样。一旦我得到这个排序,我希望改进我的if语句来识别最终用户的连接问题。我正在看这篇文章。http://www.ioscreator.com/tutorials/display-an-alert-view-in-ios8-with-swift我也看到了这个答案SimpleAppDelegatemethodtoshowanUIAlertController(inSwift)但我得到了一个关于未命名的window的类似方法。我没有所有噪音的代码是这样的:classNewsViewController:UIViewCo

ios - UIAlertController/ActionSheet 在 iPad 上崩溃,如何传递发件人?

我想在iPhone和iPad设备上显示一个ActionSheet。虽然我的代码在iPhone上可以正常工作,但在iPad上却不行。这样做的原因是我需要指定显示弹出窗口的位置。因此,我尝试使用thisanswer中提出的代码.我目前遇到的问题是,我不知道如何将参数sender传递给方法。例如,我有一个UITableViewRowAction,单击它时应显示ActionSheet:functableView(tableView:UITableView,editActionsForRowAtIndexPathindexPath:NSIndexPath)->[UITableViewRowAct

iOS 显示警报 Controller 对象

我有更多页面将显示UIAlertController。所以我需要在一页的方法和类中编写警报代码。我想使用类并调用方法可以在任何Viewcontroller上显示警报。如何在类中编写presentviewcontroller。我的头文件如下:#import#import"VisionAPI.h"@interfaceVisionAPI:NSObject+(void)showMessageAlert:(NSString*)titleandMessage:(NSString*)msgandDoneMsg:(NSString*)done;@end我的实现文件如下:#import"VisionAP

ios - 如何将图像放在 UIActionSheet 上?

如何将图像放在UIActionSheet上文本的正确位置。就像苹果音乐播放器中给出的那样。注意:不要用自定义View回答,如果可以在UIActionSheet中使用,请告诉我们。 最佳答案 Don'tanswerwithcustomview那么您实际上是在禁止任何人回答,因为这就是您所做的。首先,UIActionSheet这个东西是不存在的。它在四年前就被弃用了。今天我们使用UIAlertController。UIAlertController只是一个预先打包的呈现ViewController。它没有您不能为自己做的事。也刻意的非常

ios - 没有模糊 View 效果的 UIAlertController 操作表

我正在使用UIAlertController进行一些操作。但我不太喜欢操作组View中的模糊View效果(请参见下面的屏幕截图)。我正在尝试消除这种模糊效果。我在网上做了一些研究,但在UIAlertController中找不到任何API可以消除这种模糊效果。另外,根据他们的苹果文档here:TheUIAlertControllerclassisintendedtobeusedas-isanddoesnotsupportsubclassing.Theviewhierarchyforthisclassisprivateandmustnotbemodified.我看到Instagram也消除

ios - 带有白色边框的 alertController

我创建了一个带有操作表和两个按钮的警报Controller。由于操作表将具有圆角边缘,因此在屏幕上的四个角上会出现白色。我尝试更改alertcontroller的背景颜色,但这是将操作表制作为具有锐边而不是圆形边框的矩形。我尝试将View背景颜色设置为清除颜色也尝试设置边界半径。这是我的行动表。我希望那些白色边缘不可见。另外,如何更改取消的背景颜色。letcancelAction=UIAlertAction(title:"Cancel".localize(),style:.cancel){_in//thisiswhereIamcreatingthecancelAction}编辑-1:为

swift - 使用 UIAlertController 发出警报无法解除它

我正在创建一个提醒,但当用户按下OK时我无法关闭它。我收到以下错误:2017-12-2807:03:50.301947-0400Prestamo[691:215874]APIerror:returned0width,assumingUIViewNoIntrinsicMetric我在Internet上到处搜索,但找不到任何对我有帮助的东西。overridefuncviewDidAppear(_animated:Bool){createAlert(title:"Licencia2",message:"Enelmomentonotienesunalicenciaválida!")}funcc

ios - Swift 委托(delegate)返回 nil

我尝试从UITableViewCell中调用UIAlertController。我有我的代表protocolDEPFlightStripCellDelegate{funccallAlert(AlertCon:UIAlertController!)}我在下面的TableViewCell类中调用了它。classDEPFlightStripCell:UITableViewCell{vardelegate:DEPFlightStripCellDelegate?@IBActionfuncchangeClearedFlightLevel(sender:UIButton){letAddAlert:U