UIButton title disappears

前端 未结 5 1651
囚心锁ツ
囚心锁ツ 2021-01-20 03:52

I have a ViewController with an UIButton inside. When I clicked, the text on the button disappeared. I add all the setTitle for all states, but it continues disappearing. An

5条回答
  •  滥情空心
    2021-01-20 04:56

    I noticed a peculiar thing. If I set the title using

      bttn.titleLabel.textColor = [UIColor purpleColor];
    

    Then as soon as I click the button, the title disappears. But, if I use the following method :

    [bttn setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
    

    Then everything is working correctly.

提交回复
热议问题