我正在尝试制作这种简单的布局:
这只是一个简单的UICollectionViewCell
。
但是当我把所有需要的汽车布局限制时,我得到了这个警告:
NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x17028dd40 H:[UIImageView:0x13fd3b000(48)]>",
"<NSLayoutConstraint:0x17028e2e0 H:|-(8)-[UILabel:0x13fd3bfe0'Something as a title...'] (Names: '|':_UIVisualEffectContentView:0x13fd3ace0 )>",
"<NSLayoutConstraint:0x17028e380 UILabel:0x13fd3bfe0'Something as a title...'.leading == UIImageView:0x13fd3b000.leading>",
"<NSLayoutConstraint:0x17028e470 H:[UIImageView:0x13fd3b000]-(8)-[UILabel:0x13fd3b140'Lady Oracle']>",
"<NSLayoutConstraint:0x17028e4c0 H:[UILabel:0x13fd3b140'Firstname Lastname']-(8)-| (Names: '|':_UIVisualEffectContentView:0x13fd3ace0 )>",
"<NSLayoutConstraint:0x17028e830 H:|-(0)-[UIVisualEffectView:0x13fe0ebd0] (Names: '|':UIView:0x13fe142d0 )>",
"<NSLayoutConstraint:0x17028e8d0 H:[UIVisualEffectView:0x13fe0ebd0]-(0)-| (Names: '|':UIView:0x13fe142d0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x17428ee70 h=-&- v=-&- _UIVisualEffectContentView:0x13fd3ace0.width == UIVisualEffectView:0x13fe0ebd0.width>",
"<NSAutoresizingMaskLayoutConstraint:0x17028fd20 h=--& v=--& H:[UIView:0x13fe142d0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17028dd40 H:[UIImageView:0x13fd3b000(48)]>
从日志中可以推断,我有以下约束:
我似乎没有足够的限制来制作我想要的布局并摆脱警告。不过,布局正如预期的那样出现。
答案 0 :(得分:0)
我能想到两件事:
您忘记使用..
设置视图[view setTranslatesAutoresizingMaskIntoConstraints:NO];
当集合视图尝试布局时,您的collectionView单元格大小。