UILabel contentView is 'left' out of IB but the default should be 'redraw'
UILabel contentView is 'left' out of IB but the default should be 'redraw'
- Subject: UILabel contentView is 'left' out of IB but the default should be 'redraw'
- From: Roland King <email@hidden>
- Date: Tue, 8 Feb 2011 23:15:27 +0800
According to the documentation for UILabel the default contentMode is 'redraw'. I've been chasing an issue in my code where I set the center and bounds of one in layoutSubviews of the parent to keep it centered but it wasn't being, it was moving all over the place. I randomly found that calling setNeedsDisplay on the UILabel fixed the issue. Digging deeper I found that using setFrame: instead of setCenter: and setBounds: worked without the setNeedsDisplay. I don't really like using setFrame: if I can avoid it because it only works with unit matrix transforms.
Checking the documentation the default for a UILabel should be redraw, but I found that any UILabel dragged into IB actually has contentMode 'left' set, which is I think what stopped the setBounds doing the right thing and redrawing.
1) does that sound like an IB bug which needs reporting?
2) why does setFrame cause a redraw when setBounds/setCenter doesn't if the contentMode is set to 'left' either they all should, or they all shouldn't.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden