我有:
- UIView(容器)
- 界面视图。(1) 的子视图 - 下图中的深蓝色
- 界面视图。(1) 的子视图 - 下图中的紫色
- UIL标签。edge.equalToSuperview()
我要完成的工作:
问题是,我希望 UILabel 旋转 3pi/2 (270°)。一旦我完成了旋转,它就没有正确放置。
这是通过设置 edges.equalToSuperview() 和 270°旋转后的样子:
我试过这个(但它会导致崩溃):
myLabel.makeConstraints { make in
make.top.equalTo(containerView.snp.left)
make.right.equalTo(containerView.snp.top)
make.left.equalTo(containerView.snp.bottom)
make.bottom.equalTo(containerView.snp.right)
}
崩溃描述:
*** Terminating app due to uncaught exception 'NSInvalidLayoutConstraintException', reason: 'Constraint improperly relates anchors of incompatible types: <SnapKit.LayoutConstraint:0x6100000ad8c0@MyClass.swift#250 MyProject.MyLabel:0x7fcc2201ca80.top == UIView:0x7fcc2201bd30.left>'
有什么想法我可以在这里做什么吗?