无法通过常规措施更改 MFMailComposer 的外观,但是您可以采取一些解决方法,我之前已经使用过很多次了。
将两个方法添加到您希望在其中实现新外观的类:
- (void)applyComposerInterfaceAppearance
{
[[UINavigationBar appearance] setTintColor:[UIColor blueColor]];
}
- (void)applyGlobalInterfaceAppearance
{
// My default color of choice
[[UINavigationBar appearance] setTintColor:[UIColor redColor]];
}
现在在您的 show 方法中,应用您想要进行的特殊作曲家界面更改。
- (void)showMailComposer
{
if ([MFMailComposeViewController canSendMail])
{
[self applyComposerInterfaceApperance];
MFMailComposeViewController *viewController = [[MFMailComposeViewController alloc] init];
viewController.mailComposeDelegate = delegate;
[viewController setToRecipients:mailRecepients];
[viewController setSubject:mailSubject];
[viewController setMessageBody:messageBody isHTML:NO];
[self presentModalViewController:viewController animated:YES];
}
}
在您的委托中,将界面更改回原来的样子。
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
// Do normal mail composer did finish stuff in here
[self applyGlobalInterfaceAppearance];
}