По умолчанию мой почтовый композитор поднимает фоновое изображение своего представления контроллера представления. Поэтому у меня есть логика, чтобы отключить этот фон, который работает как чавканье в тренажере, но не на физическом устройстве (или в аренде iPhone 4S Оба используют IOS 8.1MFMailComposeViewController navigationBar override работает в симуляторе, но не в устройстве
- (void)composeEmail
{
if ([MFMailComposeViewController canSendMail])
{
self.mailComposer = [[MFMailComposeViewController alloc] init];
self.mailComposer.mailComposeDelegate = self;
// Disable navbar styling in presenting VC
[[UINavigationBar appearance] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
NSString *emailTitle = @"Subject";
NSString *messageBody = @"Body";
//configure mail message
[self.mailComposer setSubject:emailTitle];
[self.mailComposer setMessageBody:messageBody isHTML:NO];
// Present mail view controller on screen
[self.callingController presentViewController:self.mailComposer animated:YES completion:^{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}];
}
} else {
// alert here
}
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
// Enable navbar styling in presenting VC
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"logo.png"] forBarMetrics:UIBarMetricsDefault];
// Close the Mail Interface
[self.callingController dismissViewControllerAnimated:YES completion:NULL];
}
Что не работает, не могли бы вы его разработать? – gabbler