1

It seems like I am not able to change the title on the navigation bar, which gets set to the Subject of the email (in this case "My Subject"). In this case I'd like to get rid of the title, either using an empty string as title or rendering the title invisible.

MFMailComposeViewController *mfViewController = [[MFMailComposeViewController alloc] init];
mfViewController.mailComposeDelegate = self;       
[mfViewController setSubject:[NSString stringWithFormat:@"My Subject"]];
[mfViewController setMessageBody:[self emailBody] isHTML:NO];
[mfViewController setTitle:@""];
4

1 回答 1

1

where u have presented ModalViewController

[self presentModalViewController:controller animated:YES]; // Existing line

add

[[[[controller viewControllers] lastObject] navigationItem] setTitle:@"Set the title"];

I believe this is some kind of protection came with iOS4.

It is clearly stated here that you MUST NOT change the interface provided by Apple.

http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html

Important: The mail composition interface itself is not customizable and must not be modified by your application. In addition, after presenting the interface, your application is not allowed to make further changes to the email content. The user may still edit the content using the interface, but programmatic changes are ignored. Thus, you must set the values of content fields before presenting the interface.

i have searched the forums and some have got their app rejected, so i guess u should refrain urself from doing this.

hope it helps. happy coding :)

于 2012-08-31T13:25:32.333 回答