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
30
votes
2 answers

Adding line breaks in iOS alert messages using Objective-C

A noob question. I have an alert: "alertMessage" = "This is my message: 1 2 3. And another one: 5 6 7"; which I am displaying with: NSString *asd = NSLocalizedString (@"alertMessage", @""); NSString *alertTitle = NSLocalizedString…
EarlGrey
  • 2,514
  • 4
  • 34
  • 63
29
votes
5 answers

How can I init a text field in a UIAlertView

The updated UIAlertView now has a style which allows a Text input field in UIAlertView i.e. alert.alertViewStyle = UIAlertViewStylePlainTextInput; This works well but I wanted to init the input text with a defualt text like "sample". I see that…
timeview
  • 291
  • 1
  • 3
  • 5
29
votes
10 answers

How to create an alert box in iphone?

I would like to make an alert type box so that when the user tries to delete something, it says, "are you sure" and then has a yes or no for if they are sure. What would be the best way to do this in iphone?
Blane Townsend
  • 2,888
  • 5
  • 41
  • 55
29
votes
6 answers

Custom Alert (UIAlertView) with swift

How can i create a custom alert with Swift? I try translating a guide from Objective c but loads a full screen layout for do it easy i can load a new layout with the transparent background i try this: listaalertviewcontroller.view.backgroundColor =…
Pedro Manfredi
  • 3,768
  • 5
  • 19
  • 24
29
votes
4 answers

iOS 7 bug or my bug in UIAlertView

I have got the following stack trace while my app crashes on tapping "OK" on a UIAlertView. Is it my fault or a iOS7 bug? I don't know how to fix this. OS Version: iOS 7.0 (11A465) Report Version: 104 Exception Type: EXC_BAD_ACCESS…
Hans One
  • 3,329
  • 27
  • 28
27
votes
3 answers

View on top of everything: UIWindow subview VS UIViewController subview

In order to make a UIView on top of all views like the behavior of UIAlertView, the best way I see is by putting it in the app window, which is by adding the view to: [[[UIApplication sharedApplication] delegate] window] However, the downside I…
Zian Chen
  • 510
  • 1
  • 5
  • 11
27
votes
5 answers

Detecting button pressed when there are multiple alert views

I have multiple alert views in one view, and I use this code to detect which button was pressed: -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSString *title = [alertView…
Jack Humphries
  • 13,056
  • 14
  • 84
  • 125
27
votes
5 answers

UIAlertView: Where the cancel button should be?

The alert views in iOS system: Install App OTA: the cancel button is on the LEFT. Delete an App: the cancel button is on the RIGHT. Where the cancel button should be?
Míng
  • 2,500
  • 6
  • 32
  • 48
27
votes
4 answers

IOS create UIAlertViewController programmatically

I'm working on a ViewController with code (no storyboard). I'm trying to add and AlertController I have declare propery in .m @property (nonatomic, strong) UIAlertController *alertController; And init in loadview method //alertviewController …
Lê Khánh Vinh
  • 2,591
  • 5
  • 31
  • 77
27
votes
7 answers

How to remove Enter Password and Cancel button from Touch ID alert view

I got stuck that don't want Enter Password in the Alert of thumb impression [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"UNLOCK_ACCESS_TO_LOCKED_FEATURE", nil) reply: ^(BOOL…
Rahul Gupta
  • 501
  • 1
  • 7
  • 15
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
27
votes
5 answers

Is it possible to NOT dismiss a UIAlertView

The UIAlertviewDelegate protocol has several optional methods including: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; This would seem to suggest that not all button clicks actually dismiss the alert view.…
Corey Floyd
  • 25,929
  • 31
  • 126
  • 154
27
votes
2 answers

How can I schedule local notification for the following scenario?

Experts, I have a scenario wherein I need to notify user three times a day (morning, afternoon, evening). And the timings for these notifications will be different for each day, based on database values for each date. These three notifications are…
Haris Farooqui
  • 944
  • 3
  • 12
  • 28
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