iphone - UIView animate frame of ImageView -
i'm trying add animation uiimageview when button tapped. when button tapped want imageview move right @ same time increasing in size. have tried code, imageview aren't animation correct.
- (ibaction)ba:(id)sender { [uiview beginanimations:nil context:null]; [uiview setanimationcurve:uiviewanimationcurvelinear]; [uiview setanimationduration:0.5]; cgrect frame = imageview.frame; frame.origin.x = frame.origin.x + 30; frame.size.hight = frame.size.hight + 20; frame.size.width = frame.size.width + 20; imageview.frame = frame; [uiview commitanimations]; }
this code makes imageview move little right, again. wierd behavior, should animate both size , origin @ same time?
the problem you've got autolayout turned on. autolayout, cannot change frame of something, because layout comes along , changes again.
either turn autolayout off, or else animate changing constraints of view instead of frame.
Comments
Post a Comment