Reputation: 1427
Do anywho know a custom UIAlertView class what is working in iOS5 ? I'm looking for a class like TSAlertView, with that I will able to put 2 buttons stacked into alert. ( http://cocoacontrols.com/platforms/ios/controls/tsalertview )
Thanx for help.
Upvotes: 1
Views: 1283
Reputation: 27147
UIAlertView
in iOS 5
has UIAlertViewStyles
UIAlertViewStyleDefault
UIAlertViewStyleSecureTextInput
UIAlertViewStylePlainTextInput
UIAlertViewStyleLoginAndPasswordInput
EDIT Sorry for misunderstanding your problem. The alert view shown in the linked page is extremely easy to reproduce. Here's what I came up with:
I implemented this with a category for convenience but you could easily just implement it elsewhere. Basically what you do is add a cancel button and then hide it. That way there are three buttons as far as the alert view is concerned and it does not place the two visible buttons side by side. The category implementation is as follows:
-(void)showWithCutCancelButton{
// Make sure alert view will look right
if (self.cancelButtonIndex == -1 || self.numberOfButtons < 3) return;
self.clipsToBounds = YES; // or else cancel button will still be visible
[self show];
// Shrink height to leave cancel button outside
self.bounds = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height - 64);
}
Then you show this by calling:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"Message here" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Option1", @"Option2", nil];
[alert showWithCutCancelButton];
Upvotes: 2