【发布时间】:2011-05-11 21:16:06
【问题描述】:
我有这样的错误:当我单击 navigationbar.backItemButton 时,我显示 UIAlertView 有两个按钮。当我按下其中任何一个时,应用程序仅以 EXC_BAD_ACCESS 终止。方法 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 不调用。我该如何解决?谢谢!
//h - 文件
@interface DetailsTableViewController : UITableViewController <UITextFieldDelegate, UIAlertViewDelegate>
//m - 文件
- (void)viewWillDisappear:(BOOL)animated
{
//if changes unsaved - alert reask window
if (isDirty)
{
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Save changes?"
message:@"Press YES if you want to save changes before exit, NO - other case."
delegate: self
cancelButtonTitle: @"NO"
otherButtonTitles: @"YES", nil];
[message show];
[message autorelease];
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex: buttonIndex];
if([title isEqualToString: @"YES"])
{
[self saveBtnUserClick];
}
}
【问题讨论】:
标签: iphone uialertview exc-bad-access