增加图像的宽度而不修改其位置

时间:2011-08-11 18:06:10

标签: iphone xcode animation uiimageview width

我有一个图像“oeuf2”whitch位于屏幕的中心,我添加了这段代码:

[UIView transitionWithView:oeuf2 duration:0.5 options:UIViewAnimationOptionTransitionNone animations:^(void) {


        CGRect newRect = oeuf2.frame;



        newRect.size.width = 300;

        oeuf2.frame = newRect;    





    } completion:^(BOOL finished) {



    }];

增加宽度。但是当我这样做时,图像移动也是它的中心,所以我的问题是如何在不改变其位置的情况下增加“oeuf2”的宽度。

1 个答案:

答案 0 :(得分:1)

尝试使用

CGPoint center = oeuf2.center;
//Change the frame here
oeuf2.center = center;

希望这有帮助。

相关问题