简体   繁体   中英

Auto layout constraints from intrinsic content size

我是否可以指定一个约束,说view1的顶部应该比视图的内在内容大小顶部(而不是视图的顶部)高8点?

Have a look at overriding the NSView method alignmentRectInsets

By default these insets are zero so we tend to think the intrinsicContentSize means the frame size. But with auto layout you also have an alignment rect which is actually the rect that defines alignment with constraints.

So what you want is an inset of 8 at the top.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM