Confused
Confused

Reputation: 3926

How to change MFMessageComposeViewController's Contact picker's title color and text?

I'm using MFMessageComposeViewController in my application to present the sending sms feature within the app using the following code.

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];

Also you need to import its delegate and header file in .h file as,

#import <MessageUI/MessageUI.h>
...
@interface YourViewController : UIViewController <....., MFMessageComposeViewControllerDelegate>

The sms view controller will look like..

enter image description here

Problem:

The problem is, I used a custom color throughout my app. That color was getting reflected in this sms view controller's navigation bar color like this..

enter image description here

But I do not want to show the custom title color here. I just want to show the default one. Is it any way to change this custom title color to the default one?

Note: I added the custom navigation title color in Appdelegate's didFinishLaunchingWithOptions method

Upvotes: 0

Views: 2169

Answers (2)

Confused
Confused

Reputation: 3926

I got the solution by following code..

[[UINavigationBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];    
[[UIBarButtonItem appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

Here, I just define nil to the background color of ABPeoplePickerNavigationController class. All other classes in my application will have the same navigation bar color and same back button's color (that is, custom color that I added to the navigation bar's appearance in AppDelegate).

Upvotes: 1

Peter Warbo
Peter Warbo

Reputation: 11710

You can use UIAppearance appearanceWhenContainedIn and then add your classes that are applicable.

Upvotes: 2

Related Questions