uialertcontroller

inputAccessoryView animating down when alertController (actionSheet) presented

对着背影说爱祢 提交于 2019-12-05 07:08:40
I have an inputAccessoryView for a chat app that always remains visible and docked at the bottom of the screen for text input similar to most messaging apps. When I present an alertController with actionSheet style, the inputAccessoryView animates down off screen as the alert is presented and then back up again when the alert is dismissed. This in turn scrolls my tableView and is undesirable. This is happening because the chat viewController is giving up firstResponder when the alert is presented. Is there anyway to present an alertController and not give up firstResponder, or anyway to keep

Attempt to present UIAlertController on View Controller which is already presenting (null) [Swift]

我只是一个虾纸丫 提交于 2019-12-05 05:52:32
I have an alert view that I am trying to present on a photo view. The photos are displayed in a list and can be pushed to a full-screen view. The photo view is being displayed programmatically. I think that is what is causing the issue because the alert view is trying to present another view, on top of the (photo) view that's already presented. The alert view is trying to display, but getting this error: Warning: Attempt to present <UIAlertController: 0x147d2c6b0> on <LiveDeadApp.ListViewController: 0x147d614c0> which is already presenting (null) The line that might be in question is this one:

dismiss UIAlertController presented by a modal view controller

回眸只為那壹抹淺笑 提交于 2019-12-05 05:51:06
I seem to be running into a problem similar to one in an unresolved posted question: UIAlertController dismissing his presentingViewController I am presenting a modal view controller on top of a normal UIViewController. Then I'm popping up an alert on that modal view controller. When I push "ok" to dismiss the alert (generated with the code below), the modal view controller is also dismissed. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action{ [self dismissViewControllerAnimated: YES completion: nil];}]; UIAlertController

How can I display a popup message in Swift that disappears after 3 seconds or can be cancelled by user immediatelly?

走远了吗. 提交于 2019-12-05 05:43:23
In my swift app I have a UIViewController with a single button. This button invokes a function that calls a popup that disappears after 3 seconds. Also, after that time it prints a message to the console. The code of this function is as follows: func showAlertMsg(title: String, message: String){ let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert) self.presentViewController(alertController, animated: true, completion: nil) let delay = 3.0 * Double(NSEC_PER_SEC) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay)) dispatch_after(time, dispatch_get

UIAlertController 'UIAlertAction' tag/userdata or anything in Swift

泪湿孤枕 提交于 2019-12-05 04:22:31
in my iOS actionsheet, I am showing Names from the JSON dictionary: [ { "Name": "Doctor for Disease AAA", "Doctor_id": "21" }, { "Name": "Doctor for Disease BBB", "Doctor_id": "22" }, { "Name": "Doctor for Disease AAA", "Doctor_id": "25" } ] So, on button click delegate, I can get the button index and can fetch the corresponding 'Name' and 'Doctor_id'. This is working fine. But now it seems like 'UIActionSheet' is deprecated, and I have to use 'UIAlertController'. As I have a large data, I am iterating through my array values and calling the alertcontroller handler (so a single function for

self.navigationController?.popViewControllerAnimated from UIAlertController

半腔热情 提交于 2019-12-05 04:21:27
I'm new to swift but I think I'm getting a hang of it. This stumped my progress pretty hard though. What I want to do is to throw an error message to the user when we can't find relevant data to his query, and then proceed to take him back to the previous ViewController. However, I'm having real trouble doing this. On the line where I add the action I get the following error: 'UIViewController?' is not a subtype of Void let alertController = UIAlertController(title: "Oops", message: "We couldn't find any data for this title, sorry!", preferredStyle: UIAlertControllerStyle.Alert)

Select text in UIAlertController's text field

 ̄綄美尐妖づ 提交于 2019-12-05 03:52:23
I need the text of the text field to be selected right after the UIAlertController is presented. However, the way I select text in a standard UITextField doesn't work here. This is what I tried, but I can't seem to get it work. let ac = UIAlertController(title: "Rename", message: nil, preferredStyle: .Alert) ac.addTextFieldWithConfigurationHandler({ [] (textField: UITextField) in textField.selectedTextRange = textField.textRangeFromPosition(textField.beginningOfDocument, toPosition: textField.endOfDocument) textField.text = "filename.dat" }) ac.addAction(UIAlertAction(title: "CANCEL", style:

show the textField in the alertController in swift

雨燕双飞 提交于 2019-12-05 02:09:06
问题 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,

Is it possible to rotate UIAlertController (and Alert) in landscape orientation?

天涯浪子 提交于 2019-12-05 00:52:49
问题 I am editing an app where I added a new UIViewController to configure a multiplayer game in one layout. I have added two buttons for each player (top button, bot button). Each button generates an alert at the screen (remember it is in landscape orientation ) but the problem is, player 2 do not see the alert rotated, I mean, the alert is supposed to be shown in his orientation, in front of me. As there any way to do this? I want to rotate an Alert for the player 2 will not see the information

Loop over multiple UIAlertController's

我只是一个虾纸丫 提交于 2019-12-05 00:22:11
问题 In some cases my applications needs to display muliple Alert messages. Error messages are gathered on start and needs to be displayed to the user one at a time. When the first one is acknowledged, the next one should be presented. The problem is that they all try to execute at the same time, obviously. Is there a smart way to do this synchronously? Here is some code that simply describes what I want to do: var errors : [NSError]! override func viewDidLoad() { super.viewDidLoad() // Do any