【发布时间】:2016-07-26 09:49:34
【问题描述】:
我正在使用两个按钮 button1 和 button2 和一个 view1,当我单击 button2 时,view1 框架应该升高到一定高度,当按下 button2 时,view1 应该被释放到正常位置(原始位置),可以请帮忙写代码。
- (IBAction)button2:(id)sender {
[liftView setFrame:CGRectMake(2.0, 3.0, 200.0, 10.0)];
}
- (IBAction)button1:(id)sender {
//here i need the view back to the original position
}
【问题讨论】:
-
你能显示你的代码吗?通过编辑将它们放入您的问题中。
-
好的。我现在添加
-
@raptor 我添加了代码。
-
我注意到您标记了旧版本的 iOS。你在使用自动布局吗?如果是,
setFrame:将不起作用。您应该改为调整自动布局约束 -
不,我没有使用自动布局..