Is it possible to have alert view buttons above each other instead of next to each other?
Not without customizing (subclassing) the UIAlertView class. If you wanted to take this route, you'd have to alter the UIAlertView's layoutSubviews
method to place its buttons in different locations.
If there are enough buttons or the text is too long, the buttons will display above each other instead of next to each other. UIKit decides for you and there's no way to control it.
If you want to risk it, or you're not aiming at the AppStore, you could use the undocumented setNumberOfRows method on UIAlertView.
- (void) showAlert
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Your title"
message:@"Your message" delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"One", @"Two", @"Three", nil];
[alert setNumberOfRows:3];
[alert show];
}
@Lucas - yes they will really reject an app for calling setNumberOfRows: on UIAlertView. My app got through in many updates until they finally rejected and update for this reason.
@Martin - it actually appears to truncate the text that won't fit.
You can use UIActionSheet
Take a look in here at the samples :)
http://www.timeister.com/2010/06/objc-show-alert-iphone/
Good luck,
Adrian