Question

When I try to push my MFMailComposeViewController it says I can't push navigation controllers?! Hmm... dunno about that.

Basically all my view controllers are actually subclasses of CustomUIViewController which automatically removes the title view from the navigation bar (as I have a logo in the navigation bar instead).

Presenting my MFMailComposeViewController modally puts the title back in there because I can't make it subclass CustomUIViewController (or can i? I dunno?).

So I really need a way to remove the title view from the MFMailComposeViewController.

Thanks

Tom

Was it helpful?

Solution

A few easy options:

  • Subclass MFMailComposeViewController too.
  • Don't subclass CustomUIViewController; override some methods in a category of UIViewController (icky).
  • Hide the title item in a category of UINavigationBar

OTHER TIPS

Considering the title view contains the Cancel and Send buttons, I'm not sure you'd want to remove it. You could try changing the actual title in the navigation bar with

mailController.navigationItem.titleView = myLogo;

Which should set that center area of the nav item to be your logo instead of some text.

Although it would be nice to get more control over the appearance, I don't think there is a clean method. When you can't change it, I think you should hide it:

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjects:  [NSArray arrayWithObjects:[UIColor clearColor], nil] forKeys:[NSArray arrayWithObjects:UITextAttributeTextColor, nil]]];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top