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
27
votes
15 answers

How to display activity indicator in center of UIAlertController?

I currently have a UIAlertController being displayed on the screen. The view of the alert should only display 2 elements, a title and a UIActivityIndicatorView in the center of the alert. Below is the function that displays the alert and its…
Satre
  • 1,724
  • 2
  • 18
  • 22
27
votes
10 answers

Display UIAlertController from UIView/NSObject class

I have working iOS application In order to support iOS8, I am replacing UIAlertView/UIActionSheet with UIAlertController. Problem : For display UIAlertController I need presentViewController method of UIViewController class. But UIAlertView is…
Jageen
  • 6,345
  • 2
  • 37
  • 56
27
votes
11 answers

UIAlertController if iOS 8, otherwise UIAlertView

I want to conform to the UIAlertController used in iOS 8 since UIAlertView is now deprecated. Is there a way that I can use this without breaking support for iOS 7? Is there some kind of if condition I can do to check for iOS 8 otherwise do…
Rocky Pulley
  • 22,531
  • 20
  • 68
  • 106
25
votes
6 answers

Add image to alert view

I have an alert view that pops up when the user press the add button. How do i add an image to the alert view? I added some code that i took reference from stack overflow. My save button is replaced with the image and the image appear to be in blue…
Cherry_thia
  • 696
  • 1
  • 10
  • 24
24
votes
1 answer

swift UIAlertController with pickerView button action stay up

I am new in swift and I am trying to make UIAlertContoller with PickerView but I have problems with the Buttones, Here a photo I am trying to change the constraint of the buttons to stay up. I read a lot of answers here but I did not find any…
Sahar Vanunu
  • 345
  • 2
  • 5
  • 19
24
votes
10 answers

UIAlertController change font color

Here's my code that creates the UIAlertController // Create the alert controller var alertController = UIAlertController(title: "Are you sure you want to call \(self.number)?", message: "", preferredStyle: .Alert) // Create the actions …
leerob
  • 2,876
  • 1
  • 18
  • 38
23
votes
3 answers

Show an alert when iOS app is in the background

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…
K.K
  • 2,647
  • 1
  • 26
  • 32
23
votes
3 answers

Cancel Button in UIAlertController with UIAlertControllerStyle.ActionSheet

I want to add a separated cancel button to my UIAlert. I know how to do it with UIActionSheet but it should also be possible with UIAlert, right? var sheet: UIActionSheet = UIActionSheet(); let title: String = "..."; sheet.title = title; …
user4001326
22
votes
7 answers

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

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…
Miles
  • 625
  • 2
  • 9
  • 18
22
votes
4 answers

Change Action sheet popover arrow in iOS8

i'm using UIAlertController . But on iPad with iOS 8, actionSheet show with popover arrow. Any ideas to hide that arrow? Here is my code: UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"this is alert controller"…
TienLe
  • 614
  • 2
  • 9
  • 33
21
votes
3 answers

Warning: Attempt to present on <...> which is already presenting (null)

I have a long press gesture set on a UITableView that presents a UIAlertController containing the cell's text. When the UIAlertController is presented I get this warning: Attempt to present on…
MortalMan
  • 2,582
  • 3
  • 23
  • 47
21
votes
3 answers

Where to find a clear explanation about swift alert (UIAlertController)?

Couldn't find a clear and informative explanation for this.
Nikita Kurtin
  • 5,889
  • 4
  • 44
  • 48
21
votes
5 answers

How to change UIAlertController height?

I created an UIAlertController let alertC = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert) alertC.addTextFieldWithConfigurationHandler(addTextField) alertC.addAction(UIAlertAction(title: "Cancel",…
szuniverse
  • 1,076
  • 4
  • 17
  • 32
20
votes
8 answers

change UIAlertcontroller background Color

Ok so I have this alert that I am using and I want the background of it to be black not grey like it is. I have managed to change the colour of the text for the title and the message but not the background colour. Well to the desired colour I want.…
MNM
  • 2,673
  • 6
  • 38
  • 73
20
votes
2 answers

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

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…
Nicholas
  • 1,915
  • 31
  • 55