How to move an UIViewController?

2019-09-08 09:39发布

I want to do an app like Facebook with the menu that appears on the left when you push on the panel button. To do that, I have a first UIViewController with an UITableView, and another put above with a modal transition without animation. To display the UITableView (my menu), I want to move my second UIViewController on the right.

How can I do that ? It is the right way ?

2条回答
Deceive 欺骗
2楼-- · 2019-09-08 10:07

How can I do that ?

Just used a UIView animation to move the view of the view controller. Add another view that is your menu, and move that using the same animation. It's actually pretty easy.

[UIView animateWithDuration:.5 animations:^{
    [menu setFrame:CGRectOffset([menu frame], [menu frame].size.width, 0)];
    [mainView setFrame:CGRectOffset([mainView frame], [menu frame].size.width, 0)];
}];

It is the right way ?

I don't know what you mean by "the right way"... Sooooo, maybe?

查看更多
我只想做你的唯一
3楼-- · 2019-09-08 10:08

What you need is provided as a template. Check this git..download it..and play around with it..

https://github.com/pkluz/ZUUIRevealController

查看更多
登录 后发表回答