使用aoutolayout ON以编程方式修改UIButton宽度

时间:2013-11-21 19:34:41

标签: ios objective-c uibutton

我需要在运行时修改UIButton的宽度。具有此按钮的xib文件已启用自动布局。

 CGFloat delta = 40.0;
            self.Button.frame = CGRectMake(self.Button.frame.origin.x - delta,
                                                    self.Button.frame.origin.y,
                                                    self.Button.frame.size.width + delta,
                                                    self.Button.frame.size.height
                                                    );

如何在自动布局上执行此操作?

1 个答案:

答案 0 :(得分:1)

创建指定宽度的约束的出口。如果要更改框架,请不要。更改约束。