Apple says, that all I have to do is to modify the bounds rectangle. Then the content inside the bounds rectangle would be stretched or jard into the frame rectangle.
Apple说,我所要做的就是修改边界矩形。然后,边界矩形内的内容将被拉伸或延伸到框架矩形中。
But when I assign another CGRect with a smaller width to my bounds rectangle, nothing happens. The UIImageView keeps looking exactly the same. No compile errors. I guess that's not the way to go...
但是当我将另一个宽度较小的CGRect分配给我的边界矩形时,没有任何反应。 UIImageView看起来完全一样。没有编译错误。我想这不是要走的路......
how do you do that?
你是怎样做的?
2 个解决方案
#1
changing the frame will stretch or compress an image. If it doesn't, I suspect you have a bug and we need to see your code to help further.
更改框架将拉伸或压缩图像。如果没有,我怀疑你有一个错误,我们需要看到你的代码进一步帮助。
If you want to scale the image see this question.
如果要缩放图像,请参阅此问题。
#2
If you're using a uiview, you need to send beginAnimations:context: to uiview (http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW14)
如果你正在使用uiview,你需要发送beginAnimations:context:到uiview(http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref / DOC / UID / TP40006816-CH3-SW14)
EDIT: Try applying a CGAffineTransform to the view. I think the function is CGAffineTransformMakeScale(). You'll have to double check the docs.
编辑:尝试将CGAffineTransform应用于视图。我认为该函数是CGAffineTransformMakeScale()。你必须仔细检查文档。
#1
changing the frame will stretch or compress an image. If it doesn't, I suspect you have a bug and we need to see your code to help further.
更改框架将拉伸或压缩图像。如果没有,我怀疑你有一个错误,我们需要看到你的代码进一步帮助。
If you want to scale the image see this question.
如果要缩放图像,请参阅此问题。
#2
If you're using a uiview, you need to send beginAnimations:context: to uiview (http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW14)
如果你正在使用uiview,你需要发送beginAnimations:context:到uiview(http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref / DOC / UID / TP40006816-CH3-SW14)
EDIT: Try applying a CGAffineTransform to the view. I think the function is CGAffineTransformMakeScale(). You'll have to double check the docs.
编辑:尝试将CGAffineTransform应用于视图。我认为该函数是CGAffineTransformMakeScale()。你必须仔细检查文档。