uialertcontroller

iOS 8.3 UIAlertController crashes when trying to add a textfield

穿精又带淫゛_ 提交于 2019-11-30 06:40:50
I have an iPad app. I am creating an UIAlertController and adding a textfield. It crashes. It only crashes when I add a textfield. let alert = UIAlertController(title: "Enter Name", message:nil, preferredStyle: UIAlertControllerStyle.Alert); alert.addTextFieldWithConfigurationHandler { (textfield:UITextField!) -> Void in textfield.placeholder = "Sexy time"; } alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: {(action:UIAlertAction!) -> Void in //Some action here })); self.presentViewController(alert, animated: true, completion: nil); I get a fun crash

UIAlertController is Crashed (iPad)

我怕爱的太早我们不能终老 提交于 2019-11-30 06:35:12
问题 I am using Xcode 6 to develop an iOS Application. When I used UIAlertController , it can be worked well on iPhone 6 simulator, but crashes on iPad simulator. My problem while clicking "share", then it could be crashed. How could I solve it? Here is my Code: override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject] { var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share", handler: { (action

KEEP keyboard ON when UIAlertcontroller is presented in Swift?

£可爱£侵袭症+ 提交于 2019-11-30 04:59:18
When the alert pops up the keyboard is dismissed. I have looked everywhere but did not find solutions to keep the keyboard visible. When alert is presented the textfield seems to resign first responder automatically as the alert is presented modally. How is it possible to keep the keyboard behind this alert which means the textfield still editing even if no interaction will be possible ? Sam This solution works for me: let rootViewController: UIViewController = UIApplication.sharedApplication().windows.lastObject.rootViewController!! rootViewController.presentViewController(alert, animated:

Show UIAlertController over keyboard

陌路散爱 提交于 2019-11-30 03:24:19
In iOS 8 and lower show a UIActionSheet when keyboard is presented will present the action sheet over the keyboard. With iOS 9 this is no longer the case. In my app we have a chat functionality and want the show a action over the keyboard. We used to use UIActionSheet which worked fine until iOS 8. In iOS 9 the action sheet is present behind the keyboard. I've tried both UIActionSheet and UIAlertController . What we want is a action sheet like in messages.app I've tried placing the action sheet in it own window and overriding canBecomeFirstResponder which just made the keyboard disappear. Leo

How to have a numberpad in a textfield of an alert controller [swift]

最后都变了- 提交于 2019-11-30 02:14:10
问题 I'm trying to call an alert controller which has a textfield. But I'd like to show immediately the numberpad since the user should input numbers only. I tried with the following but it does not work. let alert = UIAlertController(title: "New Rating", message: "Rate this!", preferredStyle: UIAlertControllerStyle.Alert) let cancelAction = UIAlertAction(title: "Cancel", style: .Default, handler: { (action: UIAlertAction!) in }) let saveAction = UIAlertAction(title: "Save", style: .Default,

'UIAlertView' was deprecated in iOS 9.0. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead

无人久伴 提交于 2019-11-30 01:23:39
I have see more so answers , but nothing helped.Here is my older alert and action for that override func viewWillAppear(animated: Bool) { if Reachability.isConnectedToNetwork() == true { print("internet connection ok") } else { print("internet not ok") let alertView: UIAlertView = UIAlertView(title: "Alert ", message: "connect to internet", delegate: self, cancelButtonTitle: "settings", otherButtonTitles: "cancel") alertView.show() return } } func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) { if buttonIndex == 0 { //This will open ios devices wifi settings

How to hide title/message frame in a UIAlertController?

六眼飞鱼酱① 提交于 2019-11-30 00:19:41
When using a UIAlertController , if I want to present a UIActionSheet with an empty title and an empty message, the frame for the expected placement of the title and/or message remains. How do I change this so that I only present an ActionSheet that reads: Settings Sign out Cancel ? Thanks! When I create a UIAlertController with this code I don't have the title spacing. [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; Are you passing in nil for the title and message or empty strings? beee If you want to change in run time depending

Customize UIAlertController in iOS 8 to include standard elements like UITableView

不羁的心 提交于 2019-11-29 22:24:21
I am used to customize UIAlertViews through the [ alert setValue:someView forKey:@"accessoryView"] method. This creates customizable content for UIAlertViews with custom heights. However it only works on iOS7 and down. In iOS8 the UIAlertController have taken over, and I cannot customize it anymore, it will cut the height of the UIAlertView . Is it impossible because of misuse of the UIAlertController , or how am I supposed to do it? I am trying to incorporate a UITableView inside a UIAlertController with UIAlertControllerStyleAlert . Thx. I ran into the same issue right now. I looked at the

UIAlertController:supportedInterfaceOrientations was invoked recursively

自古美人都是妖i 提交于 2019-11-29 22:08:04
When two alert present one by one, i means one alert present and over them another alert presenting and app crashing. I have used UIAlertController to display alert. App crashing only in iOS 9 device. Please help me at this point. Annie This is a bug in iOS 9 that it failed to retrieve the supportedInterfaceOrientations for UIAlertController . And it seems it dropped to an infinite recursion loop in looking for the supportedInterfaceOrientations for UIAlertController (e.g., it tracks back to UIAlertControler -> UIViewController -> UINavigationController -> UITabBarController ->

Unable to choose order of buttons in UIAlertController

孤街浪徒 提交于 2019-11-29 18:50:57
问题 I was under the impression that if the normal action is a destructive action and the other is a cancel action in their UIAlertController that the destructive one should be on the left and the cancel should be on the right. If the normal action is not destructive, then the normal action should be on the right and the cancel should be on the left. That said, I have the following: var confirmLeaveAlert = UIAlertController(title: "Leave", message: "Are you sure you want to leave?", preferredStyle