Questions tagged [uialertview]

UIAlertView, a class contained in Apple's UIKit framework, was used to display an alert to the user. Alerts could have a title, message, several buttons, and custom subviews. UIAlertView was deprecated in iOS 8.

UIAlertView, a class contained in Apple's UIKit framework, was used to display an alert to the user. Alerts could have a title, message, several buttons, and custom subviews. UIAlertView was deprecated in iOS 8 and replaced with UIAlertController.

Use the properties and methods defined in this class to set the title, message, and delegate of an alert view and configure the buttons. You must set a delegate if you add custom buttons. The delegate should conform to the UIAlertViewDelegate protocol. Use the show method to display an alert view once it is configured.

Resources:

2558 questions
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
9 answers

How to add an action to a UIAlertView button using Swift iOS

I want to add another button other than the "OK" button which should just dismiss the alert. I want the other button to call a certain function. var logInErrorAlert: UIAlertView = UIAlertView() logInErrorAlert.title = "Ooops" logInErrorAlert.message…
Stephen Fox
  • 14,190
  • 19
  • 48
  • 52
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
2 answers

EXC_BAD_ACCESS code 2 on UIAlertView in iOS6

I'm trying to figure out why im getting this crash in my app. It works perfectly fine in Xcode 4.4 running in the simulator with ios5.1, but when i switch into xcode 4.5 and ios6 I'm getting an EXC_BAD_ACCESS code 2. Here is my code: - (void)…
Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90
42
votes
10 answers

Check if a UIAlertView is showing

I have a method that posts HTTP data and displays a UIAlertView if there is an error. If I have multiple HTTP post I will show multiple UIAlertView for every error. I want to show a UIAlertView only if is not showing other UIAlertView. How can I…
Ricibald
  • 9,369
  • 7
  • 47
  • 62
40
votes
11 answers

Dismiss UIAlertView after 5 Seconds Swift

I've created a UIAlertView that contains a UIActivityIndicator. Everything works great, but I'd also like the UIAlertView to disappear after 5 seconds. How can I Dismiss my UIAlertView after 5 seconds? var alert: UIAlertView = UIAlertView(title:…
Serge Pedroza
  • 2,160
  • 3
  • 28
  • 41
38
votes
12 answers

Changing the background color of a UIAlertView?

I want to change the background color of my UIAlertView, but this doesn't appear to have a color attribute.
Aishwarya
  • 1,587
  • 3
  • 14
  • 9
38
votes
5 answers

Simple App Delegate method to show an UIAlertController (in Swift)

In obj-C when another iOS app (mail attachment, web link) was tapped with a file or link associated with my app. I would then catch this on openURL or didFinishLaunchingWithOptions and show a UIAlertView to confirm the user wants to import the data.…
Greg Robertson
  • 2,317
  • 1
  • 16
  • 30
37
votes
1 answer

Hide UIAlertView programmatically?

Is there a way to hide UIAlertView programmatically? Actually I have added a UITextField in UIAlertView and I want to perform the same operation as on "Ok" button press when a user hits the keyboard return key.
Saurabh
  • 22,743
  • 12
  • 84
  • 133
37
votes
5 answers

Several UIAlertViews for a delegate

Currently I've got a class popping up UIAlertViews here and there. Currently, the same class is the delegate for these (it's very logical that it would be). Unfortunately, these UIAlertViews will call the same delegate methods of the class. Now, the…
quano
  • 18,812
  • 25
  • 97
  • 108
35
votes
7 answers

iOS - Push notification alert is not shown when the app is running

I've integrated push notifications in my app. Users will receive push notification to join a group. When the user clicks Join, I've to handle something in the code. And so I'm implementing: - (void)application:(UIApplication *)application …
Satyam
  • 15,493
  • 31
  • 131
  • 244
35
votes
8 answers

'UIAlertView' was deprecated in iOS 9.0. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead

I have see more so answers , but nothing helped.Here is my older alert and action for that override func viewWillAppear(animated: Bool) { if Reachability.isConnectedToNetwork() == true { print("internet connection ok") } else { …
user5513630
  • 1,709
  • 8
  • 24
  • 48
34
votes
7 answers

Keyboard pops up after UIAlertView is dismissed on iOS 8.3 for iPad

With the latest iOS 8.3 release, our app starts to have a weird behavior. After finishing textfield editing, the user can click the close button which brings up an UIAlertView. When the user clicks discard in the alertview, alertview and current…
Helen
  • 341
  • 1
  • 3
  • 4
31
votes
3 answers

how to use UIAlertController

I am trying to use this code in a Pacman game I got from some website but had to change UIAlertView to UIAlertController except the following code has two errors that I don't know how to fix (I am really new to programming and feel like this is a…
Howie Chowie
  • 329
  • 1
  • 3
  • 3
31
votes
12 answers

Dismissing UIAlertViews when entering background state

Apple recommends dismissing any UIAlertViews/UIActionSheets when entering background state in iOS 4. This is to avoid any confusion on the user's part when he relaunches the application later. I wonder how I could elegantly dismiss all UIAlertViews…
François P.
  • 5,166
  • 4
  • 32
  • 31