Objective-c – Segmentcontrol Color on load

iphoneobjective c

I am having some trouble with my segmentcontrol bar. I am trying to make it a gray/black color with this:

segmentControl3.tintColor = [UIColor colorWithRed:0.60 green:0.60 blue:0.60 alpha:1.0];

Under my getSegment action, and that works just fine when I click it. But my problem is that the load color is the standart blue one, and I can't seem to change that anywhere… I have tried to place it under viewDidLoad, but that diden't seen to work. I have read trough the UICatalog example, but in there all is declared in code. Is that the only way to get it right?

Thanks

Best Answer

You should be able to use tintColor to change the color of your control; try placing it in viewWillAppear:. Also make sure that your outlet is properly set. I use this in several applications.

You can use [UIColor colorWithWhite: 0.6 alpha: 1.0] to save a little code

Related Topic