开发者

Simulate push view animation inside UIView

I have a single UIView with some labels that display attributes from objects inside an array. I'm using gesture recognizers to change the current element in the array and hence the text in the开发者_开发知识库 labels. My question is how do I mimic a push animation without actually pushing a new view controller. Thanks for your help.


Thats simple way to use CGAffineTransformMakeTranslation to move any view from X axis to Y axis using UIViewAnimation. Before using this transition set your object frame to some x,y axis(0,0) and pass your x and y to move from.

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
CGAffineTransform transform = CGAffineTransformMakeTranslation(x,y);

YOUR ViewOBJECT.transform=transform;


[UIView commitAnimations];


Have you tried to use the UIView class methods for animation? For example this could help:

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations

In the animations block you could move one view out and another in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜