views:

96

answers:

2

The only solution that i can think of so far is by adding images.. but i want the right solution...so i there any way to change the text/title color???

A: 

http://www.framewreck.net/2010/07/custom-tintcolor-for-each-segment-of.html

On this post there is the implementation of a category that does what you are looking for.

From iOS SDK, there is no method to do this directly.

vfn
hey...thanks a lot ...this worked...but will this cause any rejection by apple ?? I have made an extension of this class and now i am able to set the text color.. :) If you don't mind can u tell me what is the difference between a category and an extension?
Arun Abraham
I wouldn't cause a rejection by Apple, because it's not using any private methods or API. Although since the whole customization is done navigating through the UISegmentedControl hierarchy, it could stop working, on future releases of the iOS, if Apple changes the structure of UISegmentedControl.
vfn
Categories and Extensions (http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/ObjectiveC/Articles/ocCategories.html#//apple_ref/doc/uid/TP30001163-CH20-SW1)
vfn
If you consider my answer as correct click on the check-mark on the left side of my answer to set it as correct.
vfn
A: 

A grep for "color" in the iOS 4.x UIControl and UISegmentedControl headers doesn't turn anything useful.

hotpaw2