使用动画修改 UIButton 宽度
这是我的代码,
-(IBAction)casser{
oeuf1.contentMode = UIViewContentModeScaleAspectFit;
[UIView animateWithDuration:1.0 animations:^{
CGRect newRect = oeuf1.frame;
newRect.size.width *= 5;
oeuf1.frame = newRect;
[oeuf1 release];
}];
}
“oeuf1”是一个 UIButton 当我触摸按钮时,我想将其宽度乘以五,但是当我这样做时,按钮会向右移动,并且其宽度不会改变。我该如何解决这个问题?
Here is my code ,
-(IBAction)casser{
oeuf1.contentMode = UIViewContentModeScaleAspectFit;
[UIView animateWithDuration:1.0 animations:^{
CGRect newRect = oeuf1.frame;
newRect.size.width *= 5;
oeuf1.frame = newRect;
[oeuf1 release];
}];
}
"oeuf1" is a UIButton
I want to multiply its width by five when I touch the button, but when I do that the button moves to the right and its width doesn't change. How can I solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过测试的代码 100% 有效
将每个方法与指定的方法连接起来
Tested code 100% works
connect each method with specified
有效答案:
删除
[oeuf1 release];
The working answer:
Remove
[oeuf1 release];
你为什么不直接使用
Why don't you just use