I know his disappointment, but I also did not find a solution for this. Instead, I found a workaround for everything to be done as I expect them to work.
I deleted "AutoLayout" (checkbox in storyboard)
Then:
[self.label setText:@"Labeltext"]
[self.label setBackgroundColor:[UIColor orangeColor]]
[self.label setNumberOfLines:0]
[self.label sizeToFit]
works like a charm, but also:
self.label.frame = CGRectMake(0, 0, 50, 50);
So, if you do not need AutoLayout (for me this is the first thing that I will take off) get rid of it.
source
share