Alessandro
Alessandro

Reputation: 4110

Method for Dismissing a UIAlertView

I was wandering if it was more correct to dismiss a UIAlertView using:

[alert removeFromSuperview];

Or using:

[alert dismissWithClickedButtonIndex: 0 animated: TRUE];

The first one seems to give problems...

Upvotes: 0

Views: 215

Answers (2)

nsgulliver
nsgulliver

Reputation: 12671

Alert is a popup view so should always be dismissed using [alert dismissWithClickedButtonIndex: 0 animated: YES];

Upvotes: 2

Alastair Stuart
Alastair Stuart

Reputation: 4185

Always use dismissWithClickedButtonIndex. Removing the view from the superview has undefined behaviour - we have no idea what the iOS internals are doing.

Upvotes: 2

Related Questions