3

Can you stop UIAlertView from dismissing?

I want based on what button is pressed, to either animate adding a UITextField, or dismiss it. But I can't add a text field after the alert is dismissed.

Devfly
  • 2,495
  • 5
  • 38
  • 56

2 Answers2

1

You should implement the UIAlertViewDelegate method :

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex

and based on the button index you can perform your custom action.

Otherwise you should either create your own alertview class or subclass UIAlertView.

If you choose to subclass you can override the method :

-(void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated 

to avoid dismissing the alertView if a specific button is pressed

oiledCode
  • 8,589
  • 6
  • 43
  • 59
0

If you simply want to add a UITextField after the UIActionSheet is dismissed then add a method that when the ActionSheet gets dismissed then call the method for the TextField.

IronManGill
  • 7,222
  • 2
  • 31
  • 52