Note that there are some explanatory texts on larger screens.

plurals
  1. POset title color for UIButton when highlighted iOS 7
    primarykey
    data
    text
    <p>I have the following code in a viewController, all the outlets and action are hooked up correctly. the <code>WHITE</code> and <code>PURPLE</code> are UIColors that I've defined constants for. I've also set the <code>UIWindow</code>'s <code>tintColor</code> to <code>PURPLE</code> and that propagates down to the button.</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; [button setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; button.backgroundColor = WHITE; button.layer.borderWidth = 1.0; button.layer.masksToBounds = YES; button.layer.cornerRadius = 5.0; button.layer.borderColor = PURPLE.CGColor; } -(IBAction) buttonTouchDown:(id)sender { button.backgroundColor = PURPLE; button.layer.borderColor = WHITE.CGColor; } -(IBAction) buttonTouchUpOutside:(id)sender { button.backgroundColor = WHITE; button.layer.borderColor = PURPLE.CGColor; } -(IBAction) buttonTouchUpInside:(id)sender { button.backgroundColor = WHITE; button.layer.borderColor = PURPLE.CGColor; } </code></pre> <p>When I click the button the text doesn't go white like i told it to in <code>viewDidLoad</code></p> <p>here's some screenshots that I could've cropped better! As you can see in the highlighted state it's not white but like a white and purple mix. Will I need to use <code>UIButtonTypeCustom</code>? I heard if I do that I won't get the advantages of iOS 7 doing its magic with <code>tintColor</code>. Not sure what's the correct way to go about this. Thanks in advance.</p> <p><img src="https://i.stack.imgur.com/Bb3BX.png" alt="normalState"> <img src="https://i.stack.imgur.com/hwtzM.png" alt="highlightedState"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload