views:

511

answers:

1

Hi everyone!

I have a quick question I was hoping someone here with more experience could shed some light on.

I am currently using the AddressBookUI framework (basically ABPeoplePickerNavigationController) to display a list of contacts from which a user may select one and drill down to the contact details view. Something really ordinary, nothing out of this world.

However, I would like to modify the color of the searchbar, section headers and the background of the contact view displayed once a contact is selected from the tableView list.

It seems that no matter what I try (override UINavigationController methods, set the properties directly upon loading the view in viewLoaded, loop through the subviews in the single contact view iteratively setting backgroundColor to clearColor and setting an underlying view to the background image, etc) the changes do not stick. The headers/searchbar are always blue and the background in the single contact view is always the pin-striped blue/white background (in the case of the iterative setting of clearColor for all subviews, I get very erratic behavior for this, and it just feels like such an ugly hack).

Does anybody know how this can be acomplished? I suspect it has to do with the fact that the view is a modal view. Any insights??

I really don't want to have to access the lower level c API. Having to solve it this way would be a mess with regard to localization as I wouldn't know how to sort the contacts list and the tableView index in so many non-roman alphabet languages (I can free-ride this if I manage to keep using the cocoa-based framework). Plus, I'm pretty sure Apple's optimizations for loading/dealing with the contact list would outperform my own anyways. From what I can glean Apple gets to access the AB sqlite database directly, while I would inevitably be forced to access it from yet another level of abstraction... (c-based API)

Wouldn't mind rolling out my own address book views using the c API (which is ridiculous overkill due to all the data-management overhead for just changing some colors and a background...but oh well) if you guys could alternatively point me towards multiple-language/alphabet aware sorting options (obviously just modifying the colors + background while sticking with the AddressBookUI framework would be preferable).

ANY insight at all is EXTREMLY appreciated!!

THANK YOU SO MUCH,

Jose

+1  A: 

Good Luck. You are digging into unexposed parts of that API and you may or may not be able to get the result you want. It would be mostly be trial and error and since you're not using published APIs, future OS upgrades could break your app, etc.

Apple prefers to maintain consistency over the look and feel of certain parts of the UI. The Address Book interface is one of these.

If you just want your app to match that part, I wouldn't worry about it. If there are some hard requirements, and you want to stay away from unpublished APIs, you'll likely be rolling your own solution, which as you've already mentioned, seems like a lot of work for such a minor cosmetic change.

Kailoa Kadano