美文网首页
UIAlertView 点击按钮后不消失

UIAlertView 点击按钮后不消失

作者: 3a169b0787bc | 来源:发表于2017-05-25 11:32 被阅读297次

这两天遇到一个需求就是在弹框里的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;

相关文章

网友评论

      本文标题:UIAlertView 点击按钮后不消失

      本文链接:https://www.haomeiwen.com/subject/ccdhxxtx.html