0
我想用swift添加constratints。用swift添加对tableview单元格的限制
正如你可以在屏幕截图中看到的,我必须将图像放入蓝色泡泡盒内。
我用宽度以下行:
bubbleImageView.addConstraint(NSLayoutConstraint(item: bubbleImageView, attribute: .Width, relatedBy: .Equal, toItem: photoView, attribute: .Width, multiplier: 1, constant: 50))
正如你可以看到它运作良好。 (我知道中心x不看正确的,但宽度约束工作我没有添加的centerX和centery约束现在)
我想对于高度similiar代码下面一行:
bubbleImageView.addConstraint(NSLayoutConstraint(item: bubbleImageView, attribute: .Height, relatedBy: .Equal, toItem: photoView, attribute: .Height, multiplier: 1, constant: 0))
而且结果:
这是为什么不工作?图像大小固定为150x150。我该如何解决这个问题?