我打电话给:
emailDetailView.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(cancel)];
emailDetailView.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(emailAddressSelected:emailAddressReturned:)];
UINavigationController *emailDetailNavCon = [[UINavigationController alloc] initWithRootViewController:emailDetailView];
[self presentModalViewController:emailDetailNavCon animated:YES] ;
这是我选择的方法引用:
-(void) emailAddressSelected:(NSString *)emailAddressSelectedString {
NSLog(@"emailAddressSelected is %@", emailAddressSelectedString);
emailAddressReturned = emailAddressSelectedString;
[self performSelector:@selector(showMailComposeController)];
}
-(void)cancel {
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1]
animated:YES];
}
从子视图上的按钮(取消或完成)回调都没有达到我的预期。
我试图弄清楚如何单击子模式视图取消按钮关闭模式视图并显示父视图。
我还试图弄清楚如何在子模式视图中单击“完成”按钮来执行该emailAddressSelected:(NSString *)emailAddressSelectedString
方法。
现在对该emailAddressSelected:(NSString *)emailAddressSelectedString
方法的调用正在生成“无法识别的选择器发送到实例”错误。
我已经尝试了以前问题的许多变体,但仍然得到错误或没有得到我期望的按钮操作。
任何帮助,将不胜感激。