Reputation: 2846
So basically I am trying to dynamically change the height of a view based on three different labels inside of it. I use _labelName_.frame.size.height
to get the height for all three. This works great in iOS 8, however in iOS 7 one returns 17 (should be 33), the other two both return 0, and they should be 22.5 and 16.5.
I'm at a loss as to why iOS 7 and iOS 8 are returning different frame heights, any help would be greatly appreciated!
Edit: Did a little debugging. Turns out, the frame heights are 0 in iOS 7, but not in iOS 8. It seems that layoutSubviews is working differently on iOS 7 than it is on iOS 8. Any reason that layoutSubviews would lay out the subviews differently between the two versions?
Upvotes: 0
Views: 60
Reputation: 278
Try calling [_labelName_ sizeToFit]
after setting the text and before accessing the frame
Upvotes: 1