这听起来像是一份工作
UIAlertView
. 而不是调用popViewControllerImated:
IBAction
方法,alloc/init a
UIAlertView
把它呈现出来。然后,当用户点击
UIAlertView
,取消
UIAlertView
打电话来
popViewControllerAnimated:
.
- (IBAction)backBtnUserClicked:(id)object {
UIAlertView *av = [[[UIAlertView alloc] initWithMessage:@"Wait!"
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil] autorelease];
[av show];
}
在你的
UIAlertViewDelegate
方法调用
PopViewControllerImated:
.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
[[self navigationController] popViewControllerAnimated:YES];
}
要设置“后退”按钮上的操作:
[[[self navigationController] leftBarButtonItem] setTarget:self];
[[[self navigationController] leftBarButtonItem] setAction:@selector(backBtnUserClicked:)];