UIAlertView 点击按钮后不消失

2017-05-25  本文已影响297人  3a169b0787bc

这两天遇到一个需求就是在弹框里的TextField里输入,在确定适合做内容判断。因此在确定按钮点击的时候可能结果是给出错误的输入提示,然后不消失弹框。又懒得自己去自定义,搜了一圈方法。最后找到一个解决的方法
重写UIAlertView 里的方法
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated方法
如果想消失就直接super调用一下。不然就不调用了。

// hides alert sheet or popup. use this method when you need to explicitly dismiss the alert. // it does not need to be called if the user presses on a button
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;

上一篇 下一篇

猜你喜欢

热点阅读