1
votes

My first view is embedded in a navigation controller where I set its translucent property to NO. This gives me the flat green I want, and the status bar a white color. However, when I open an MFMailComposeViewController, the translucent property is set back to YES and the status bar goes back to black.

How do I remove the translucency and set the status bar back to white? Below is my code.

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

    self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    [self.navigationController.navigationBar setTranslucent:NO];
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 1) {
        if (indexPath.row == 0) {
            NSArray *toRecipents = [NSArray arrayWithObject:@"email goes here"];
            MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
            mc.mailComposeDelegate = self;
            [mc.navigationBar setTintColor:[UIColor whiteColor]];

            [mc.navigationController.navigationBar setTranslucent:NO];

            [mc setSubject:@"Inquiry"];
            [mc setMessageBody:@"Hi, " isHTML:NO];
            [mc setToRecipients:toRecipents];
            [self presentViewController:mc animated:YES completion:NULL];
        }
    }
}

View1View2

1

1 Answers

1
votes

This worked for me:

[[UINavigationBar appearance] setTranslucent:NO];