6
A
回答
30
您需要更改UIImageView
的CGFrame像这样 -
[imageView setFrame:CGRectMake(100, 100, imageView.frame.size.width, imageView.frame.size.height)];
这改变了uiimageview
poistion到(100, 100)
同时保持高度和宽度相同。请注意,您可以使用上述代码不仅更改(x,y)
的位置,还更改视图的大小。使用下面的代码,你可以制作动画太:)
如果你想动画的位置变化 -
[UIView animateWithDuration:0.35
delay:0.0
options: UIViewAnimationCurveEaseOut
animations:^{
[imageView setFrame:CGRectMake(100, 100, imageView.frame.size.width, imageView.frame.size.height)];
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
0
self.psView.frame = CGRectMake(self.wvView.frame.origin.x, self.wvView.frame.origin.y, self.psView.frame.size.width, self.psView.frame.size.height);
+3
欢迎来到Stack Overflow!尽管这段代码可以解决这个问题,但[包括一个解释](// meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)确实有助于提高您的帖子的质量。请记住,您将来会为读者回答问题,而这些人可能不知道您的代码建议的原因。也请尽量不要使用解释性注释来挤占代码,因为这会降低代码和解释的可读性! – FrankerZ
相关问题
- 1. 如何更改UIImageView的角位置?
- 2. 改变位置的UIImageView通过选择
- 3. 更改的位置,$位置
- 4. 根据设备的大小更改UIImageView的位置
- 5. 以编程方式更改UIImageview的位置iPhone
- 6. 在OS 3.0中更改UITableViewCell中左侧UIImageView的位置
- 7. 位置更改的Android位置更新
- 8. UIImageView的Z位置与UIScrollView的位置
- 9. UIImageView无法以编程方式更改位置
- 10. 更改位置
- 11. 检查UIImageView的位置
- 12. 在UIImageView上的位置
- 13. 我是否需要在更改UIImageView的位置后更新约束条件
- 14. 更新UIImageView图像文件时,其他UIImageView的位置被重置为中心
- 15. 更改iAd的位置和位置
- 16. 更改php.ini位置
- 17. 更改MouseEventArgs位置
- 18. 更改位置UITouch
- 19. 更改node_modules位置
- 20. 更改IsolatedStorage位置
- 21. UIButton更改位置
- 22. SVN位置更改
- 23. 更改UIImageView的宽度
- 24. 更改UIImageView的大小
- 25. 无法更改的UIImageView
- 26. 更改框架的UIImageView
- 27. 仅更改UIImageView的高度
- 28. UIImageView的大小更改
- 29. 更改位置设置
- 30. 更改imageview的位置
当我尝试你的代码(动画版),我得到这个错误 发送'int'用于CGFrameMake行的不兼容类型'CGRect'(又名'struct CGRect')的参数。你知道也许是为什么? – bla0009
对不起'CGRectMake'而不是'CGFrameMake'。错字!更新了上面的代码...再试一次。 –
这是完美的。你只会缺少一个支架。我现在将其添加...投票完美答案! – bla0009