uialertcontroller

show the textField in the alertController in swift

你。 提交于 2019-12-03 16:24:14
Just now I wrote the code which is provided below. I would like to produce the output for the following code but it crashes when I run it, and it shows nil . class ViewController: UIViewController ,UITableViewDataSource{ var names = [String]() @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() title = "\"The List\"" tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell") // Do any additional setup after loading the view, typically from a nib. } @IBAction func addName(sender: AnyObject) { let alert = UIAlertController(title: "New

UIAlertAction handler running after delay

爱⌒轻易说出口 提交于 2019-12-03 15:37:31
问题 I'm trying to change my UIAlertViews to UIAlertControllers. I set up this action for it: UIAlertAction *undoStopAction = [UIAlertAction actionWithTitle:@"Undo Stop" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [self undoStop]; }]; But, the handler doesn't run until about a second after the action is tapped. Is there any way to speed this up? 回答1: The short delay is normal for Alert View (less than a second though). If this is not convenient for you, you can

UIAlertController background color iOS10

这一生的挚爱 提交于 2019-12-03 13:49:21
问题 Code that I wrote for iOS9, worked really well: UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Select source" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; alert.view.backgroundColor = DARK_BLUE; alert.view.tintColor = NEON_GREEN; UIView *subview = alert.view.subviews.firstObject; UIView *alertContentView = subview.subviews.firstObject; alertContentView.backgroundColor = DARK_BLUE; alertContentView.layer.cornerRadius = 10; My point of view is that

Switch in UIAlert Controller programmatically

喜夏-厌秋 提交于 2019-12-03 13:42:53
问题 I am creating an registration dialog in swift with 3 text field and one Switch and I successfully add three text field two the Alert. The following code shows the same. let alertController = UIAlertController(title: "Register", message: "", preferredStyle: .Alert) let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) { (action) in // ... exit(0) } alertController.addAction(cancelAction) let OKAction = UIAlertAction(title: "Sign UP", style: .Default) { (action) in // ... let name0

How to customize UIAlertController with UITableView or is there any default control available like this UI in Pages app?

痞子三分冷 提交于 2019-12-03 11:55:53
问题 I would like to implement a UIAlertViewController like this (Reference: Pages and Keynote app): . I have implemented a custom tableview and presented the view by mimicking the UIAlertViewController . But I cannot achieve a similar UI as above. Is there any default controller available for this? -(void)share:(id)sender { [self setModalPresentationStyle:UIModalPresentationCurrentContext]; AlertViewController *renameCntrl = [self.storyboard instantiateViewControllerWithIdentifier

How to dismiss an UIAlertController and the keyboard simultaneously?

岁酱吖の 提交于 2019-12-03 11:36:18
问题 I have created a signup form with a UIAlertController and used the method addTextFieldWithConfigurationHandler to add a text field. But there is a little problem. When the form shows up, the keyboard and modal appear with a smooth animation. When closing the form, the modal disappears first , and then the keyboard disappears. This makes the keyboard make a sudden downward fall. How can I make the modal and keyboard graciously disappear? lazy var alertController: UIAlertController = { [weak

IOS基础UI之(五)UIAlertView、UIActionSheet和UIAlertContro

删除回忆录丶 提交于 2019-12-03 09:56:00
IOS基础UI之(五)UIAlertView、UIActionSheet和UIAlertController详解 标签: ios UIAlertView UIActionSheet UIAlertController 2015-09-20 11:58 340人阅读 评论 (3) 收藏 举报 分类: IOS(UI基础)(10) 版权声明:本文为博主原创文章,未经博主允许不得转载。 iOS 8的新特性之一就是让接口更有适应性、更灵活,因此许多视图控制器的实现方式发生了巨大的变化。 比如说Alert Views、Action Sheets。 下面就大致介绍它们的使用方式。 UIAlertView: 1.创建 UIAlertView。 UIAlertView的按钮是水平排列的,当按钮多的时候由于考虑的位置不够,因此会垂直排列。 参数:delegate: 代理 otherButtonTitles: 其它按钮,可以添加多个。多个用逗号隔开 [objc] view plain copy UIAlertView *alert = [[UIAlertView alloc ]initWithTitle: @"标题" message : @"这个是UIAlertViewStyleDefault的默认样式" delegate : self cancelButtonTitle : @"取消"

Add image to alert view

笑着哭i 提交于 2019-12-03 09:08:30
问题 I have an alert view that pops up when the user press the add button. How do i add an image to the alert view? I added some code that i took reference from stack overflow. My save button is replaced with the image and the image appear to be in blue colour... Code for Alert View var alert = UIAlertController(title: "Spring Element \(springNumber)", message: "Add spring properties", preferredStyle: .Alert) let saveAction = UIAlertAction(title: "Save", style: .Default) { (action: UIAlertAction!)

Custom Action controller, Swift

久未见 提交于 2019-12-03 07:07:24
Does anyone know how I can code up this custom alert controller (The top area especially) - currently found on the Apple music App. Maybe there is a known library that can do it. I am aware this is how you an action controller is coded? let alertController = UIAlertController(title: nil, message: "Top Message Here", preferredStyle: .ActionSheet) let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) { (action) in // Drop View Pop up } alertController.addAction(cancelAction) let action1 = UIAlertAction(title: "Action Title", style: .Default) { (action) in //Code to Execute }

How to add Progress bar to UIAlertController?

隐身守侯 提交于 2019-12-03 06:05:05
问题 I want to add progress bar in swift iOS 8 UIAlertController. Is this possible? Is there any way to subclass UIAlertController and add progres bar and connect some delegate functions? thanks 回答1: If you just need a progressbar you can simply add it as a subview as follows: Updated for Swift 5: // Just create your alert as usual: let alertView = UIAlertController(title: "Please wait", message: "Need to download some files.", preferredStyle: .alert) alertView.addAction(UIAlertAction(title: