这是我的方法:
- (void)showAlertMsgWithKey: (NSString *)key Title: (NSString *)title CancelBtnTitle: (NSString *)cancelBtnTitle{
static int counter = 0;
UIAlertView *alertMsg = [[UIAlertView alloc] initWithTitle: title
message: [[MessageDictionary sharedInstance].msg objectForKey: key]
delegate: self
cancelButtonTitle: cancelBtnTitle
otherButtonTitles: nil];
[maAlert addObject: alertMsg];
[[maAlert objectAtIndex: counter] show];
counter++;
}
然后我尝试通过两次调用此方法来显示两个警报视图叠加在另一个上
[super showAlertMsgWithKey:@"10000" Title:@"testing" CancelBtnTitle:@"OK"];
[super showAlertMsgWithKey:@"10001" Title:@"testing1" CancelBtnTitle:@"OOKK"];
但最后编译器向我显示了这个错误:
Attempting to load the view of a view controller while it is
deallocating is not allowed and may result in undefined behaviour
(<UIAlertController: 0x7fd669f591c0>)