我有以下代码将 UIView
的位置移动到其他位置
_completedStatusView.frame =
CGRectMake(153, _completedStatusView.frame.origin.y,
_completedStatusView.frame.size.width, _completedStatusView.frame.size.height);
但是,尽管当我执行 NSLog
时,它实际上移动了,但该位置并没有移动。此外,如果我禁用自动布局,它就会起作用。
最好的解决方案是什么?
最佳答案
将您的 View 前导约束连接为 IBOutlet
说 _completedStatusViewLeading
然后执行以下操作
_completedStatusViewLeading.constant = 153.f;
关于ios - 使用 AutoLayout 移动 UIView 的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33731328/