uialertcontroller

Present “Controller” from another Class in Objective-C

泄露秘密 提交于 2019-12-24 03:29:51
问题 How does one present a UIAlertController from another class? I want to know how can you capture the action of an "ok" button in a UIAlertController that was created in Class B but presented in Class A. This is how I call the method that created the Alert on class "ErrorHandler" from ClassA: ErrorHandler *handler = [[ErrorHandler alloc] init]; [self presentViewController:[handler alertWithInternetErrorCode] animated:YES completion:nil]; And this is the implementation of

UIViewAlertForUnsatisfiableConstraints when presenting popover controller on iOS8 iPad

强颜欢笑 提交于 2019-12-24 03:16:47
问题 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"What would you like to do?" message:@"" preferredStyle:UIAlertControllerStyleActionSheet]; [alert addAction:...] //left out for brevity of post UIPopoverPresentationController *pop = [alert popoverPresentationController]; pop.sourceView = self.view; pop.sourceRect = self.view.frame; pop.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:alert animated:true completion:^{ }]; The methods in

Dismiss all UIAlertControllers currently presented

纵然是瞬间 提交于 2019-12-23 20:44:51
问题 Is there a way to dismiss all UIAlertControllers that are currently presented? This is specifically because from anywhere and any state of my app, I need to get to a certain ViewController when a push notification is pressed. 回答1: You could subclass your UIAlertController s, attach NSNotification observers to each which would trigger a method within the UIAlertController subclass to dismiss the alert controller, then post an NSNotification whenever you're ready to dismiss, ex: class

All of my UIAlertController messages became single line

别来无恙 提交于 2019-12-23 19:39:19
问题 I am not sure if this is the culprit but the biggest change I did to this project was upgrading to Swift 4 a couple of days ago. I know that my UIAlertController messages were showing multiline when needed but today I realized by chance that all of them became single line and has ellipsis at the end. Since I show these messages from an API, I cannot use "\n". The code is simple enough; let alert = UIAlertController(title: "Title", message: "Long message that must be shown as multiline",

Memory Leak using an UIAlertController in Swift

不羁的心 提交于 2019-12-23 13:21:00
问题 I present a simple UIViewController using this simple code @IBAction func addNewFeed(sender: UIBarButtonItem) { var alertView: UIAlertController? = UIAlertController(title: NSLocalizedString("New Feed", comment: "Titolo popup creazione feed"), message: NSLocalizedString("Insert the Title and the Link for the new Feed.", comment: "Messaggio creazione nuovo feed"), preferredStyle: UIAlertControllerStyle.Alert) alertView!.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment:

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

一曲冷凌霜 提交于 2019-12-22 05:06:13
问题 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

<_UIPopoverBackgroundVisualEffectView> is being asked to animate its opacity

旧街凉风 提交于 2019-12-22 03:58:33
问题 I am trying to show an (AlertController) Action sheet. But I am getting this waning in console " <_UIPopoverBackgroundVisualEffectView 0x7fd65ef76ec0> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1. " here is my code :- extension GroupDataView { func callDot (sender : UIButton) { let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) alert.addAction(UIAlertAction(title: "Edit Group", style: .default

Navigate to ViewController from UIAlertController button click

时光毁灭记忆、已成空白 提交于 2019-12-21 05:57:34
问题 I am quite new to Swift development and I tried referring to the Swift UIAlertController API but couldn't figure out how to navigate to another UIViewController after clicking a button on the UIAlertController. I would appreciate any pointers, help or a solution to this problem. My code snippet is given below - @IBAction func showAlert() { let alertController = UIAlertController(title: "Disclaimer", message: "Disclaimer Text Here", preferredStyle: .Alert) let declineAction = UIAlertAction

Navigate to ViewController from UIAlertController button click

微笑、不失礼 提交于 2019-12-21 05:57:09
问题 I am quite new to Swift development and I tried referring to the Swift UIAlertController API but couldn't figure out how to navigate to another UIViewController after clicking a button on the UIAlertController. I would appreciate any pointers, help or a solution to this problem. My code snippet is given below - @IBAction func showAlert() { let alertController = UIAlertController(title: "Disclaimer", message: "Disclaimer Text Here", preferredStyle: .Alert) let declineAction = UIAlertAction

Present a UIAlertController from within a Popover in iOS8

做~自己de王妃 提交于 2019-12-21 01:59:22
问题 I set a UITableViewController to be displayed in a popover on iPad : When I click on a row, I display an alert to warn the user of a potential destructive action. I used the new UIAlertController, and here is what happens: The popover becomes very small (the size of the alertController view in fact). If I press Cancel, I can see the result : Here is my code: override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { var previouslySelectedCell: