Devfly
Devfly

Reputation: 2495

Stop UIAlertView from dismissing

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.

Upvotes: 3

Views: 3259

Answers (2)

oiledCode
oiledCode

Reputation: 8649

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

Upvotes: 1

IronManGill
IronManGill

Reputation: 7226

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.

Upvotes: 0

Related Questions