在我的视图控制器中,我有以下代码
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSLog(@"%s",__PRETTY_FUNCTION__);
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:201.0/255.0 green:201.0/255.0 blue:201.0/255.0 alpha:1.0];
}
在此视图中,当我单击按钮时,我正在MFMailComposeViewController
模态地呈现。当我MFMailComposeViewController
以模态方式呈现时,导航栏的颜色与viewWillAppear
. 我想要默认的蓝色,因为 Apple 告诉不要自定义此视图。这是我尝试过的代码
代码 1:
-(void)sendEmailWithWithRecipients:(NSArray*)recipients andData:(NSData*)data {
if ([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
mailComposeViewController.mailComposeDelegate = self;
self.navigationController.navigationBar.tintColor = nil;
[self presentModalViewController:mailComposeViewController animated:YES];
[mailComposeViewController release];
}
else {
[self showAlertWithTitle:@"Alert" andMessage:@"Can not send email. Please check your email settings."];
}
}
但上面的代码不适用于色调
代码2:设置色调颜色viewWillDisappear
-(void)viewWillDisappear:(BOOL)animated {
NSLog(@"%s",__PRETTY_FUNCTION__);
self.navigationController.navigationBar.tintColor = nil;
[super viewWillDisappear:animated];
}
代码 2 也不起作用。
但这在 iOS5 中运行良好,无需在. 它不工作 iOS 4.xtintColor = nil
MFMailComposeViewController
viewWillDisappear
有人对此有解决方案吗?谢谢。