I am using AlertView since release of iOS8,but after release of iOS8 UIAlertView is replaces by UIAlertViewController. Then how to use it as a UIAlertView.
Asked
Active
Viewed 246 times
-1
-
1Hi and welcome to Stack Overflow. can you give us a bit more information? Also please edit your question and add the code that you tried to get it to work, and explain what the error was you got (include any relevant logfile entries if you have it). Also tell us what research you've done on the subject (so we don't duplicate your effort). Thanks – Taryn East Jan 12 '15 at 05:43
-
http://nshipster.com/uialertcontroller/ – Kirit Modi Jan 12 '15 at 05:50
-
3http://stackoverflow.com/questions/25111011/uialertview-uialertcontroller-ios-7-and-ios-8-compatibility – Kirit Modi Jan 12 '15 at 05:50
3 Answers
1
AlertView in Swift in ios8
var alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)

Kirit Modi
- 23,155
- 15
- 89
- 112

Prabhat
- 96
- 7
1
UIAlertController * myAlert= [UIAlertController
alertControllerWithTitle:@"My Alert"
message:@"put a message here"
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:MyAlert animated:YES completion:nil];

myte
- 887
- 7
- 10
0
if ([UIAlertController class])
{
// use UIAlertController
UIAlertController *alert= [UIAlertController
alertControllerWithTitle:@"Enter Folder Name"
message:@"Keep it short and sweet"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action){
//Do Some action here
}];
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
NSLog(@"cancel btn");
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:ok];
[alert addAction:cancel];
[self presentViewController:alert animated:YES completion:nil];
use this code

yogesh wadhwa
- 711
- 8
- 16