Is it possible to NOT dismiss a UIAlertView

Yes. Subclass UIAlertView and then overload -dismissWithClickedButtonIndex:animated:, e.g.

@implementation MyAlertView 
-(void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated {
   if (buttonIndex should not dismiss the alert)
      return;
   [super dismissWithClickedButtonIndex:buttonIndex animated:animated];
}
@end

Unofficially you can define a

-(void)alertSheet:(UIAlertSheet*)sheet buttonClicked:(id)button;

method to the delegate which will make it bypass -dismissWithClickedButtonIndex:animated:, but it’s undocumented, so I don’t know whether it’s suitable for you.

Leave a Comment