Questions tagged [uialertcontroller]

An iOS class, for displaying alerts and popup style selectors. Note that the legacy `UIActionSheet` and `UIAlertView` tags would not generally be used now.

In iOS, UIAlertController displays an alert message to the user, or, an action selector. (On iPhone, it's the large selector which appears from the bottom of the screen, usually with two or three choices.)

After configuration, it is presented using UIViewController.present. In the action sheet case, actions are added using UIAlertController.addAction.

This class replaced the older UIActionSheet and UIAlertView.

Apple UIAlertController Documentation

1683 questions
58
votes
9 answers

Presenting a view controller modally from an action sheet's delegate in iOS8 - iOS11

So I noticed that in iOS8 beta 3 (Update: still happens in iOS 11.2) on iPad, when attempting to present a view controller from within a delegate method of a UIActionSheet, "nothing" happens and a log message is output to the debug console, stating…
Léo Natan
  • 56,823
  • 9
  • 150
  • 195
57
votes
1 answer

Should self be captured as strong in a UIAlertAction's handler?

When writing the handler closure of a UIAlertAction, should the reference to self be strong (the default), weak, or unowned? There have been posts relevant to this topic (1, 2, 3, 4) but I honestly don't see how they help in this case. Let's focus…
Eric
  • 16,003
  • 15
  • 87
  • 139
57
votes
14 answers

UIAlertView/UIAlertController iOS 7 and iOS 8 compatibility

I am using Swift to write an app and I need to show an alert. The app must be iOS 7 and iOS 8 compatible. Since UIAlertView has been replaced with UIAlertController, how can I check if the UIAlertController is available without checking the system…
Shan
  • 3,057
  • 4
  • 21
  • 33
56
votes
6 answers

UIAlertController - add custom views to actionsheet

I'm trying to make the actionsheet as it shows in the messages app on iOS when we try to attach an image as in the screenshot. I realized in new UIAlertController, we can't fit any custom views. Any way I can make exactly this? My code looks pretty…
CalZone
  • 1,701
  • 1
  • 17
  • 29
55
votes
6 answers

How to use UIAlertController to replace UIActionSheet?

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…
Don_Chen
  • 987
  • 2
  • 8
  • 16
54
votes
9 answers

How to add text input in alertview of ios 8?

I want to add text input in alert-view of ios 8. I know it was done using UIAlertController but not have any idea. How to do it ?
Aarti Oza
  • 1,134
  • 2
  • 14
  • 31
54
votes
5 answers

Prevent dismissal of UIAlertController

I am adding a UITextField to a UIAlertController, which appears as an AlertView. Before dismissing the UIAlertController, I want to validate the input of the UITextField. Based on the validation I want to dismiss the UIAlertController or not. But I…
jona jürgen
  • 1,789
  • 4
  • 22
  • 31
50
votes
10 answers

AlertController is not in the window hierarchy

I've just created a Single View Application project with ViewController class. I would like to show a UIAlertController from a function which is located inside my own class. Here is my class with an alert. class AlertController: UIViewController { …
wtznc
  • 895
  • 2
  • 14
  • 26
49
votes
4 answers

Access input from UIAlertController

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",…
Andrew
  • 968
  • 2
  • 11
  • 22
47
votes
13 answers

UIAlertController is moved to buggy position at top of screen when it calls `presentViewController:`

Presenting a view from a UIAlertController moves the alert to a buggy position at the top-left corner of the screen. iOS 8.1, device and simulator. We have noticed this in an app when we attempt to present a view from the current "top-most" view. If…
pkamb
  • 33,281
  • 23
  • 160
  • 191
47
votes
6 answers

UIActionSheet from Popover with iOS8 GM

Anyone is getting this message while trying to show UIActionSheet from popover? Your application has presented a UIAlertController () of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is…
Tomer Peled
  • 3,571
  • 5
  • 35
  • 57
44
votes
7 answers

How to show UIAlertController from Appdelegate

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…
Rockers23
  • 775
  • 1
  • 12
  • 24
43
votes
11 answers

UIAlertController is Crashed (iPad)

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…
user5122712
43
votes
2 answers

UIAlertController showing with delay

I'm experiencing a problem with UIAlertController on my app now migrated to iOS8 with Date Picker inside. Below is the code. UIAlertController *AlertView = [UIAlertController alertControllerWithTitle:title message:nil…
43
votes
8 answers

UIAlertController text alignment

Is there a way to change the alignment of the message displayed inside a UIAlertController on iOS 8? I believe accessing the subviews and changing it for the UILabel is not possible anymore.
dkaisers
  • 824
  • 1
  • 8
  • 15