Jageen
Jageen

Reputation: 6365

Order of cancel button in UIAlertView is different in iOS8

I have project supported till iOS7, i run it in iOS8 device using Xcode 5.1. I found problem in order of cancel button in UIAlertView.

Code

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
                                                    message:@"Title"
                                                   delegate:self
                                          cancelButtonTitle:@"Cancel"
                                          otherButtonTitles:@"Button1",@"Button2",@"Button3",nil];
[alert show];

Output

enter image description here


Questions

  1. Why Cancel button location is different in both OS?
  2. Is it a new UI changes in iOS8 ? If yes please give me a reference link.

Upvotes: 2

Views: 2080

Answers (1)

Animesh Porwal
Animesh Porwal

Reputation: 567

Seems like iOS 8 onward, order of button appearance is the order in which you write them. In iOS 8 UIAlertView and UIActionSheet are deprecated. Instead use UIAlertController. Following is the reference to it:

UIAlertController Reference

The order in which you add UIAction in UIAlertController is the order in which buttons appear in alert.

UPDATE: Ordering of buttons is fixed in iOS 8 Beta 3. Position of 'Cancel' button is always last now.

Upvotes: 3

Related Questions