uialertcontroller

UiAlertView or UiAlertController to display only once in Swift

时间秒杀一切 提交于 2019-12-08 02:29:27
问题 How can I get my UiAlertController or UIAlertView to display only once in Swift? override func viewDidLoad() { var defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults() if let nameIsNotNill = defaults.objectForKey("name") as? String { self.name.text = defaults.objectForKey("name") as String } if let phoneIsNotNill = defaults.objectForKey("phone") as? String { self.phone.text = defaults.objectForKey("phone") as String } var alert = UIAlertController(title: "Disclaimer", message: "WE

Change title color in UIAlertController

微笑、不失礼 提交于 2019-12-07 14:24:43
问题 I have two button but I just wanna change one to red.When I use the function below it change all to red . I just want to change color of only one button. How can i do it? alertController.view.tintColor = UIColor.redColor() 回答1: only red Color is possible when you set UIAlertActionStyle.Destructive Check this link UIAlertController custom font, size, color 回答2: let alertController = UIAlertController(title: title, message: message, preferredStyle: .actionSheet) alertController.setValue

The handler of a UIAlertAction is a bit too late - how can I make it immediate?

孤者浪人 提交于 2019-12-07 12:29:21
问题 I am trying (...) to add a sound effect to the buttons added to a UIAlertController. I fire a sound effect in the handler, but this actually is a bit too late. The sound fires like 0.5 seconds too late. I want the sound to fire as soon as the alert is about to dismiss, not after it has dismissed. With UIAlertView this was possible to handle using alertWillDismiss... rather than alertDidDismiss. Did I miss something? 回答1: No, you didn't miss anything. The functionality you're looking for is

UIAlertController dismissing his presentingViewController

Deadly 提交于 2019-12-07 12:16:15
问题 I am trying to understand a weird behavior of my app, here is a description (tested in a trivial project). ViewControllerA is presenting modally ViewControllerB ViewControllerB contains a button, this button is presenting a UIAlertController specified this way alert = [UIAlertController alertControllerWithTitle:@"Test" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [alert addAction:[UIAlertAction actionWithTitle:@"Action" style:UIAlertActionStyleDefault handler:^(UIAlertAction

Is it possible to add a hyperlink to a UIAlertController?

浪尽此生 提交于 2019-12-07 07:06:57
问题 Technology : Objective-C, xCode 7 @property (nonatomic, copy) NSString *notes; @synthesize notes; example.notes = @"Click <a href='http://www.google.com'>here</a>"; NSString *msg = [@"" stringByAppendingFormat:@"%@", myAnnotation.notes]; UIAlertController *alertViewController = [UIAlertController alertControllerWithTitle: @"Title of Alert Box" message: msg preferredStyle: UIAlertControllerStyleAlert]; [alertViewController addAction: [UIAlertAction actionWithTitle: @"Close" style:

UIAlertController not working in iOS 9

我的梦境 提交于 2019-12-07 06:36:32
问题 I have added the UIAlertController code showing login and password textfields, it works for iOS 8 but in iOS 9 not works. The textfields shrinks as shown in figure below The code I am trying is as follows : - (void)toggleLoginLdap:(UIViewController *)currentVC { if ([UIAlertController class]) { self.alertController= [UIAlertController alertControllerWithTitle:@"Title of Msg" message:@"Hello" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK"

inputAccessoryView animating down when alertController (actionSheet) presented

心已入冬 提交于 2019-12-07 02:29:03
问题 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

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

回眸只為那壹抹淺笑 提交于 2019-12-07 01:34:36
问题 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

self.navigationController?.popViewControllerAnimated from UIAlertController

偶尔善良 提交于 2019-12-07 00:22:53
问题 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

iOS AlertView App Extension

假如想象 提交于 2019-12-06 21:46:32
I'm working in a custom keyboard (iOS App Extension) . I have a UICollectionView in my Keyboard Layout , so when one item is selected I want to show a message ( UIAlerView for example). Here is my code: - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ ... UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"My Title" message:@"Enter User Credentials" preferredStyle:UIAlertControllerStyleAlert]; [self presentViewController:alert animated:YES completion:nil]; } I get this error: 'Feature not available in extensions