Reputation: 14934
I've a subclass of UIView with a UILabel with is added as subview to the view. In the layoutSubviews method the position and height of the UILabel is calculated. My problem is, that this height should be recalculated, when the text of the UILabel changes. The text is inserted into the label from the UIViewController, so the view does not know when this happen.
Upvotes: 0
Views: 1009
Reputation: 385660
You can subclass UILabel
to override setText:
like this:
@implementation MyLabel
- (void)setText:(NSString *)text {
[super setText:text];
[self.superview setNeedsLayout];
}
Upvotes: 1