How to set the buttons label text color for state UIControlStateHighlighted

前端 未结 3 657
日久生厌
日久生厌 2021-01-12 07:01

I am creating an iPhone application in which i have a custom button. i have set the buttons title by creating a Label and adding it as subview. now when the button is highli

3条回答
  •  醉酒成梦
    2021-01-12 07:25

    Found the answer in a different question on StackOverflow: UIButton color issues

    [button1 setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    

    This is if you can work without creating a Label and adding it as subview as you mention above.

提交回复
热议问题