Changing the title of a MFMailComposeViewController

Posted by Badescu Alexandru on Stack Overflow See other posts from Stack Overflow or by Badescu Alexandru
Published on 2011-09-13T11:26:15Z Indexed on 2012/11/03 5:02 UTC
Read the original article Hit count: 272

Filed under:
|
|

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;

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c