uialertcontroller

Present UIAlertController from AppDelegate [duplicate]

女生的网名这么多〃 提交于 2019-11-27 14:17:00
This question already has an answer here: How to present UIAlertController when not in a view controller? 31 answers I'm trying to present a UIAlertController from the AppDelegate in my iOS app. Below is the alert and the present method. UIAlertController *alert = [UIAlertController alertControllerWithTitle:cTitle message:cMessage preferredStyle:UIAlertControllerStyleAlert]; //Configure alert and actions [self.window.rootViewController presentViewController:alert animated:TRUE completion:nil]; However, when I try to present the alert, it doesn't appear and I get the following alert in the

How to create uialertcontroller in global swift

别来无恙 提交于 2019-11-27 14:05:50
问题 I'm trying to create uialertcontroller in Config.swift file as follow. static func showAlertMessage(titleStr:String, messageStr:String) -> Void { let window : UIWindow? let alert = UIAlertController(title: titleStr, message: messageStr, preferredStyle: UIAlertControllerStyle.Alert); self.window!.presentViewController(alert, animated: true, completion: nil) } problem is I've found problem in self.window!. Type 'Config' has no member 'window' Please let me know how to solve that issue. 回答1:

Show an alert when iOS app is in the background

你说的曾经没有我的故事 提交于 2019-11-27 12:31:39
问题 I want to show an alert view when my iOS app is in the background (and it's using location). For example, the Uber Partner (Driver) app shows an alert and plays a sound even when: I have turned off notifications! My iPhone is in Silent mode! I am aware of the local notifications approach and it doesn't work if the user turns off/ changes the Notifications in Settings. I am looking for something different. Actions performed to reach the above state: Go online on Uber Partner App (you are the

How to use UIAlertController to replace UIActionSheet?

只愿长相守 提交于 2019-11-27 11:52:25
问题 I am maintaining an old iOS project which based on SDK 6.0. A method on this project called -(void) showComboBox:(UIView*)view:withOptions:(NSDictionary*)options is used to show a combo box. To achieve the goal, it used UIActionSheet, which is deprecated on iOS8. My solution is like this: if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8) { UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle

UIPopover How do I make a popover with buttons like this?

两盒软妹~` 提交于 2019-11-27 11:41:01
问题 I'm wondering how I can create a popover with buttons like this. ANSWER: UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle: nil delegate: self cancelButtonTitle: nil destructiveButtonTitle: nil otherButtonTitles: @"Take Photo", @"Choose Existing Photo", nil]; [actionSheet showFromRect: button.frame inView: button.superview animated: YES]; Somewhere else in your delegated object class... -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger

iOS UIAlertController bold button changed in 8.3

穿精又带淫゛_ 提交于 2019-11-27 10:41:53
问题 UIAlertController with two buttons with styles set: UIAlertActionStyle.Cancel UIAlertActionStyle.Default in iOS 8.2, the Cancel button is non-bold and Default is bold. In iOS 8.3 they have switched round You can see it Apple's own apps e.g., Settings > Mail > Add Account > iCloud > enter invalid data, then it shows like this on 8.3: Unsupported Apple ID Learn More (bold) OK (non-bold) whereas it was the other way round for 8.2. Any workaround to make it like 8.2 again. Why has it changed? 回答1

Access input from UIAlertController

烈酒焚心 提交于 2019-11-27 10:06:39
问题 I've got a UIAlertController which is prompted to the user when they choose "Enter Password" on the TouchID screen. How do I recover the user's input after presenting this on screen? let passwordPrompt = UIAlertController(title: "Enter Password", message: "You have selected to enter your passwod.", preferredStyle: UIAlertControllerStyle.Alert) passwordPrompt.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: nil)) passwordPrompt.addAction(UIAlertAction(title:

UITextField in UIAlertController (border, backgroundColor)

北慕城南 提交于 2019-11-27 08:55:59
Here is a screenshot of a UIAlertController . I was just playing around custom fonts and textfield properties but I was unable to accomplish the following: clear background of the UITextField no ugly border (black box) as shown below As I dived more into the code and iOS runtime headers, I was able to modify border and background color but the above issue still remains as those properties belong to a container UITextView . Changing background to clearColor doesn't help. Has anybody ever played around with this? Not sure if I would ever take my app into production with such ugly text fields.

Cant dismiss my previous alertcontroller completely

╄→尐↘猪︶ㄣ 提交于 2019-11-27 08:43:17
问题 I am trying to use one single alert controller which include multiple alert showing functions and one dismiss function.But I am having this warning in my console and my other alert don't show.I wonder why?and the solution for that. Here is my alert controller import UIKit class MyAlertViewController: UIViewController { var myAlertController : UIAlertController! override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() //

How to show UIAlertController from Appdelegate

无人久伴 提交于 2019-11-27 07:49:02
I'm working with PushNotification on iOS app. I would like to show a UIalertcontroller when the app receive a notification. I try this code below in the AppDelegate: [self.window.rootViewController presentViewController:alert animated:YES completion:nil]; But the UIAlertcontroller is showing in the root View (First screen) and for other uiviewcontroller i got warning or the app crashes. Anbu.Karthik try this Objective-C UIWindow* topWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; topWindow.rootViewController = [UIViewController new]; topWindow.windowLevel =