Xcode 5 Autolayout并使UIView的宽度等于高度

Pad*_*215 4 ios autolayout xcode5

我正在使用autolayout.我在IB中有一个UIImageView.我想让它的宽度等于它的高度.

我学会了如何在Xcode 4中完成大部分这些工作.我知道如何以编程方式完成它,但这产生了错误并且还没有修复Apple:

'Auto Layout still required after executing -layoutSubviews. UITableViewCell's implementation of -layoutSubviews needs to call super.'
Run Code Online (Sandbox Code Playgroud)

那么如何在Xcode 5 Interface Builder中设置这个约束呢?

Raj*_*iOS 8

正如Timothy Moose评论的那样,您可以选择在Xcode 5.1中保持宽高比.

确保宽度和高度相同.使用控件拖动自身添加宽高比约束.

在此输入图像描述

它将自动确保高度和宽度都得到保持.