您的位置:首页 > 产品设计 > UI/UE

UIAlertView点击按钮不会销毁自身View

2015-04-15 10:30 330 查看
子类化UIAlertView,复写方法
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;

/// UIAlertView subclass which can't be dismissed when buttons clicked.
@interface FixAlertView : UIAlertView

@end

@implementation FixAlertView

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated {

//    [super dismissWithClickedButtonIndex:buttonIndex animated:animated];
return;
}

@end


复写方法的时候,记得不要调用父类的方法。

参考自:http://stackoverflow.com/questions/2051402/is-it-possible-to-not-dismiss-a-uialertview/2051969#2051969
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息