Skip to main content
11 events
when toggle format what by license comment
Oct 17, 2020 at 21:32 comment added DawnSong I can't agree with you. If you want a frame-based layout compound view to work like a constraint-base view, you need to implement intrinsicContentSize just like UILabel. When mixing auto-layout and frame-based manual layout, you need to do that.
Aug 30, 2015 at 19:39 comment added algal Hmm, really? I'd be quite surprised if UIStackView uses intrinsicContentSize directly. I'd expect it uses either the short or long version of systemLayoutSizeFittingSize:. And if that's the case, then it should suffice just to establish appropriate internal constraints, rather than override intrinsicContentSize. My understanding is that the only effect of having an intrinsicContentSize is that it causes the system to automatically generate certain non-required constraints that express that preferred size.
Aug 30, 2015 at 16:58 comment added fatuhoku Interestingly, iOS 9's new UIStackView uses intrinsicContentSize to calculate the size of its subviews rather than using sizeThatFits etc.. This more or less forces the developer to override the method and call sizeThatFits directly :/
Jul 21, 2015 at 4:41 history edited algal CC BY-SA 3.0
grammar wording
Jun 4, 2015 at 16:52 history edited algal CC BY-SA 3.0
typo
Apr 21, 2015 at 14:12 comment added Bruno Morgado I'm struggling with this as well and I can't seem to be able to set the low priority constraint of height zero for the view as a whole. Interface Builder doesn't allow me to set any constraints on the main view of the .xib file. Any idea why?
Oct 15, 2014 at 8:38 vote accept dev_mush
Oct 14, 2014 at 15:34 comment added algal You need to set preferredMaxLayoutWidth in order for intrinsicContentSize to return a size that uses line-wrapping (the text and the preferredMaxLayoutWidth are the only intrinsic content, I believe). The only way to set it automatically, I think, is to override layoutSubviews somewhere and set it based on completed layout values. In contrast, systemLayoutSizeFittingSize: looks at all constraints, not just those from intrinsicContentSize. So it will be affected by (1) other constraints affecting width, and (2) the combo of numberOfLines=0 and its argument targetSize
Oct 14, 2014 at 13:30 comment added Benjohn Good tip with the systemLayoutSizeFittingSize:… methods, thanks. Are there particular issues with UILabel's preferredMaxLayoutWidth? It can just be made automatic and it'll expand to fit (other constraints), no?
Oct 14, 2014 at 5:12 history edited algal CC BY-SA 3.0
deleted 5 characters in body
Oct 14, 2014 at 5:06 history answered algal CC BY-SA 3.0