What is the best way to use custom background images for the "cancel" and "send" buttons (barbuttonit开发者_StackOverflow中文版ems
) in MFMailComposeViewController
?
A/N: I know about the note on Apple's website about not changing interfact, but I need to do this for consistency throughout the application.
You can always send the email in the background and control how the form and email buttons look. Take a look at this post and the answer on how to do that.
Locking the Fields in MFMailComposeViewController
You can customize the look of the navigationbar, cancel and send button, through app delegate.
Try this code:
UIImage*resizedImage = [[UIImage imageNamed:@"navbar1"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 12, 12, 10)];
id navbar =[UINavigationBar appearance];
id barbutton =[UIBarButtonItem appearance];
//this customises the navigation bar
[navbar setBackgroundImage:resizedImage forBarMetrics:UIBarMetricsDefault];
UIImage *backButton = [[UIImage imageNamed:@"blueButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(10 , 18, 10 , 18)];
// this customises the back bar button item in the navigation bar
[barbutton setBackButtonBackgroundImage:backButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// this for other bar button items
[barbutton setBackgroundImage:backButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
精彩评论