Jam*_*rpe 5 iphone centering ios autolayout ios6
我UILabel有时候想要在一个单元格中垂直居中.这必须以编程方式完成.我已经尝试添加以下约束来居中它(locName是UILabel):
[cell addConstraint:[NSLayoutConstraint constraintWithItem:cell
attribute:NSLayoutAttributeCenterY relatedBy:0 toItem:cell.locName
attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];
Run Code Online (Sandbox Code Playgroud)
这是我得到的结果:

看起来它的中心位置,但也许改变了它的高度UILabel?
这是IB中的视图控制器:

如何以编程方式实现垂直居中?
| 归档时间: |
|
| 查看次数: |
7087 次 |
| 最近记录: |