Mfmailcomposeviewcontroller in iOS 7 Statusbar Are Black

MFMailComposeViewController in iOS 7 statusbar are black

Set the UIApplication statusBarStyle in the completion block of presentViewController for your MFMailComposeViewController. i.e.

    MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
[self.navigationController presentViewController:mailVC animated:YES completion:^{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}];

You may also need to add and/or set "View controller-based status bar appearance" to NO in your Info.plist file.

iOS 7 MFMailComposeViewController status bar color

The following kluge appears to do the job:

        // Present the email controller.  The delegate will dismiss it.
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000
float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (systemVersion < 7.0f) {
[viewController presentViewController:emailController animated:YES completion:^{}];
}
else {
// Need a song and dance to get the header bar to show correctly. (And presentModalViewController is deprecated anyway.) Note that this code doesn't actually change the email controller's header, but it somehow lets the header below "show through" when it wouldn't otherwise. (I know -- like many of the iOS 7 fixes this makes no sense. But it works. (So far.))
#warning Sometimes produces console message "Presenting view controllers on detached view controllers is discouraged <XxxxViewController: 0xc658a70>"
[viewController presentViewController:emailController animated:YES completion:^{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
if (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
&& [[UIApplication sharedApplication] respondsToSelector:NSSelectorFromString(@"setStatusBarStyle:")]) {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
#endif
}];
}

#else
[viewController presentModalViewController:emailController animated:YES];
#endif

How to change status bar to White in MFMailComposeViewController?

Try to set statusBarStyle in completion handler while present mail controller like this

self.present(composeMail, animated: true, completion:{ () in
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent
})

Hope it will work.

iOS 7: Blank Screen when presenting MFMailComposeViewController on navigationController

I've figured out the problem, thanks so much for your help @Vibin and @rdelmar!

The problem was in my AppDelegate.m, where I had:

CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = self.window.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], (id)[[UIColor colorWithRed:0.878431373 green:0.878431373 blue:0.878431373 alpha:1] CGColor], nil];
[self.window.layer insertSublayer:gradient atIndex:0];

It seems one can't do anything to the window for a storyboard application?

Anyway, now I'm out to probably add that gradient to each view controller instead of having it in the window :)

Thanks you so much!!

MFMailComposeViewController bar background color not changing in iOS7

try this. worked for me.

MFMailComposeViewController* myailViewController = [[MFMailComposeViewController alloc] init];
// set other attributes of mailcomposer here.
myMailViewController.mailComposeDelegate = self;

[myMailViewController.navigationBar setTintColor:[UIColor whiteColor]];

[self presentViewController:myMmailViewController animated:YES completion:nil];


Related Topics



Leave a reply



Submit