Changing the title of a MFMailComposeViewController
- by Badescu Alexandru
Although i know changing MFMailComposeViewController is fround upon, i'm taking a risk.
I found some ideas such as
[self presentModalViewController:controller animated:YES]; // Existing line
[[[[controller viewControllers] lastObject] navigationItem] setTitle:@"SomethingElse"];
and
[[[[(MFMailComposeViewController*)vc navigationBar] items] objectAtIndex:0] setTitle:@" SomethingElse"];
but the odd thing is that the title is "SomethingElse" for like 2 seconds and after that it returns to the subject that is set. I've tried other solutions as well but the same output.
I am using SHK (ShareKit) to connect to social. Here is the code from showViewController :
if ([vc respondsToSelector:@selector(modalPresentationStyle)])
vc.modalPresentationStyle = [SHK modalPresentationStyle];
if ([vc respondsToSelector:@selector(modalTransitionStyle)])
vc.modalTransitionStyle = [SHK modalTransitionStyle];
[topViewController presentModalViewController:vc animated:YES];
[[[[(MFMailComposeViewController*)vc navigationBar] items] objectAtIndex:0] setTitle:@" "];
[(UINavigationController *)vc navigationBar].barStyle =
[(UINavigationController *)vc toolbar].barStyle = [SHK barStyle];
self.currentView = vc;