2013-06-26

Strange Behavior: UIButton Text will be not shown.

Because of a multilingual project, all the texts should be translated and replaced with the correct language version. Everything was fine until I found that a button won't show the text assigned.

The code:


 [button titleLabel].text = @"I won't be changed";


The result is: the button shows always the text that is set up in the storyboard. If I delete the text in Storyboard, it will even disappear when I tap!

The solution is also simple:


[button setTitle:@"I will change" forState:UIControlStateNormal]


via StackOverflow

No comments: