Open openradar-mirror opened 9 years ago
Can be fixed in subclass:
- (CGSize)intrinsicContentSize {
return CGSizeMake(super.intrinsicContentSize.width +
(self.contentEdgeInsets.left + self.contentEdgeInsets.right) +
(self.titleEdgeInsets.left + self.titleEdgeInsets.right) +
(self.imageEdgeInsets.left + self.imageEdgeInsets.right),
super.intrinsicContentSize.height +
(self.contentEdgeInsets.top + self.contentEdgeInsets.bottom) +
(self.titleEdgeInsets.top + self.titleEdgeInsets.bottom) +
(self.imageEdgeInsets.top + self.imageEdgeInsets.bottom));
}
Description
Summary: When designing a UIButton in interface builder you can set insets on the content in a UIButton to make a gap between the imageView and the the titleLabel. The render in IB is what I would expect but at runtime the calculation for intrinsicContentSize for UIButton does not take the edge insets for the titleLabel or the imageView into account and therefore breaks the layout.
Steps to Reproduce: Create UIButton Add image to imageView Add text for titleLabel add content inset to the button add content inset to the text on the left to give space between image and text run app
Expected Results: Button renders like in IB (see attached screenshot)
Actual Results: text is truncated as button is incorrectly sized by auto layout at runtime (see attached screenshot from device running iOS 8 GM)
Version: iOS 8 GM, Xcode 6 GM
Notes:
Configuration: iPhone simulator, iPhone 5s
Attachments: 'Broken Buttons.zip', 'Screen Shot 2014-09-16 at 11.47.07.png' and 'IMG_1244.PNG' were successfully uploaded.
Product Version: 8.0 GM Created: 2014-09-16T10:52:54.701669 Originated: 2014-09-16T00:00:00 Open Radar Link: http://www.openradar.me/18348992