简体   繁体   English

取消UIAlertView的方法

[英]Method for Dismissing a UIAlertView

I was wandering if it was more correct to dismiss a UIAlertView using: 我在徘徊是否更正确地使用以下方法消除UIAlertView:

[alert removeFromSuperview];

Or using: 或使用:

[alert dismissWithClickedButtonIndex: 0 animated: TRUE];

The first one seems to give problems... 第一个似乎给了问题...

Always use dismissWithClickedButtonIndex. 始终使用dismissWithClickedButtonIndex。 Removing the view from the superview has undefined behaviour - we have no idea what the iOS internals are doing. 从超级视图中删除视图具有未定义的行为-我们不知道iOS内部正在做什么。

Alert是一个弹出视图,因此应始终使用[alert dismissWithClickedButtonIndex: 0 animated: YES];来将其关闭[alert dismissWithClickedButtonIndex: 0 animated: YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM