Tulon
Tulon

Reputation: 4124

MFMailComposeViewController navigationBar color is not perfectly matching

I have already tried almost all exist solution for changing the navigationBar color of my MFMailComposeViewController, but it is not showing exact color.

This is my viewController navigation bar color:

enter image description here

And after customizing all solution the closest one is this:

enter image description here

What is the thing I am missing here in my code? please take have a look.

MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];

mc.mailComposeDelegate = self;
[mc.navigationBar setTintColor:[UIColor whiteColor]];
[mc setSubject:[NSString stringWithFormat:@"V%@ Support", version]];
[mc setMessageBody:supportText isHTML:NO];
[mc setToRecipients:@[@"[email protected]"]];
[self presentViewController:mc animated:YES completion:NULL];

I tried with:

mc.navigationBar.translucent = NO;
[mc.navigationBar setTintColor:[UIColor myColor]];
mc.navigationBar.backgroundColor = [UIColor myColor];
UIImage *image = [UIImage imageNamed:@"nav-bar_6_plus.png"];
[mc.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

But no luck.

Thanks in advance.

Upvotes: 4

Views: 854

Answers (2)

Leena
Leena

Reputation: 2676

This worked for me:-

In Swift 3.0

    UINavigationBar.appearance().isTranslucent = false

Setting the appearance of the UINavigationBar solved my problem.

Upvotes: 3

Andrew Cook
Andrew Cook

Reputation: 116

I believe its because the bar is transparent if you call

[self.navigationController.navigationBar setTranslucent:NO];

that should fix it.

Upvotes: 0

Related Questions