如何改变按钮的位置.Objective-C的

use*_*829 0 objective-c uibutton ios autolayout

stackoverflow上定位按钮的方法不起作用.我正在使用

self.todayButton.frame = CGRectMake(0, self.todayButton.frame.origin.y, self.todayButton.frame.size.width, self.todayButton.frame.size.height);
Run Code Online (Sandbox Code Playgroud)

我认为这是一个自动布局问题,但我不知道如何解决.

Pun*_*rma 5

这是一个问题Autolayout.但是您无法禁用autolayout笔尖中的特定视图.它必须在整个笔尖上禁用.更好的解决方案是使用setTranslatesAutoresizingMaskIntoConstraints该按钮:

 [self.todayButton setTranslatesAutoresizingMaskIntoConstraints:YES];
Run Code Online (Sandbox Code Playgroud)