草庐IT

uialertaction

全部标签

ios - 带有 UIAlertAction swift 的增量标签栏角标(Badge)?

@IBActionfuncaddToCart(sender:AnyObject){letitemObjectTitle=itemObject.valueForKey("itemDescription")as!StringletalertController=UIAlertController(title:"Add\(itemObjectTitle)tocart?",message:"",preferredStyle:.Alert)letyesAction=UIAlertAction(title:"Yes",style:UIAlertActionStyle.Default){(actio

ios - 在 swift 中显示 alertController 中的 textField

刚才我写了下面提供的代码。我想为以下代码生成输出,但是当我运行它时它崩溃了,并且它显示nil。classViewController:UIViewController,UITableViewDataSource{varnames=[String]()@IBOutletweakvartableView:UITableView!overridefuncviewDidLoad(){super.viewDidLoad()title="\"TheList\""tableView.registerClass(UITableViewCell.self,forCellReuseIdentifier:"

ios - UIAlertController - 如果第一次解除警报,则不会执行操作

在我正在进行的一个项目中,我必须编写一个UIAlert帮助程序模块,它可以在我的iOS应用程序中到处显示弹出窗口。弹出窗口被编写为类函数,我可以在代码中的任何地方简单地调用它们(类是静态的,所有函数也是静态的)。我现在遇到一个非常奇怪的错误,如果您关闭一次警报,然后再次打开它,它的操作将不再起作用(例如,不会调用操作处理程序)。如果您在第一次显示弹出窗口时单击该操作,它确实有效,但是......这是出现此错误的特定弹出窗口的代码(没有任何其他弹出窗口受到影响):staticfuncpopSkipWalkthrough(){letalert=UIAlertController(title

ios - UIAlertAction 值列表

我正在尝试弄清楚如何更改UIAlertAction标题的字体类型。我假设,这可以通过为特定键设置一个值来完成。例如,要设置图像,您可以这样做:action.setValue(image,forKey:"image")是否有所有可用key的列表?我不知道要使用哪个键来更改字体、左/右对齐标题等... 最佳答案 class_copyIvarList可能是您所需要的。swiftextensionUIAlertAction{staticvarpropertyNames:[String]{varoutCount:UInt32=0guardle

ios - 未调用 UIAlertAction 处理程序

我有一个UITableView并且在委托(delegate)(ViewController)中,我已经实现了函数tableView(tableView:UITableView,commitEditingStyleeditingStyle:UITableViewCellEditingStyle,forRowAtIndexPathindexPath:NSIndexPath)然后我测试编辑风格ifeditingStyle==UITableViewCellEditingStyle.Delete{//dodeletingstuffhere}作为删除的一部分,我请求用户确认,如果他们选择"is",

swift - 如何从 UIAlertController 的 UIAlertAction 处理程序中关闭 UIViewController?

我想向用户展示一个简单的UIAlertController,其中一个选项会触发父ViewController的关闭。这是我正在使用的代码:letalert=UIAlertController(title:title,message:message,preferredStyle:UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title:"CloseView",style:UIAlertActionStyle.Destructive,handler:{actioninself.dismissViewController

ios - 在 swift 中使用 uiimagepickercontroller 裁剪图像

我目前正在快速制作一个程序,其中涉及使用操作表从相机或照片库中选择图像的屏幕。这是功能齐全的,但我希望能够从所选图像中选择一个方形部分,类似于苹果默认应用程序。我该如何实现?这是我的功能代码:funcchooseImage(_sender:Any){letimagePickerController=UIImagePickerController()imagePickerController.delegate=selfletactionSheet=UIAlertController(title:"PhotoSource",message:"Chooseasource",preferred

ios - UIAlertController 'UIAlertAction' 标签/用户数据或 Swift 中的任何内容

在我的iOS操作表中,我显示了JSON字典中的名称:[{"Name":"DoctorforDiseaseAAA","Doctor_id":"21"},{"Name":"DoctorforDiseaseBBB","Doctor_id":"22"},{"Name":"DoctorforDiseaseAAA","Doctor_id":"25"}]因此,在按钮单击委托(delegate)上,我可以获得按钮索引并可以获取相应的“姓名”和“Doctor_id”。这工作正常。但现在似乎“UIActionSheet”已被弃用,我必须使用“UIAlertController”。由于我有大量数据,我正在遍

ios - UIAlertController 按钮位置不一致

UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:nilmessage:@"hello"preferredStyle:UIAlertControllerStyleAlert];UIAlertAction*ok=[UIAlertActionactionWithTitle:@"Ok"style:UIAlertActionStyleDefaulthandler:hander]UIAlertAction*cancel=[UIAlertActionactionWithTitle:@"cance

ios - UIAlertController 按钮位置不一致

UIAlertController*alertController=[UIAlertControlleralertControllerWithTitle:nilmessage:@"hello"preferredStyle:UIAlertControllerStyleAlert];UIAlertAction*ok=[UIAlertActionactionWithTitle:@"Ok"style:UIAlertActionStyleDefaulthandler:hander]UIAlertAction*cancel=[UIAlertActionactionWithTitle:@"cance