You should use CoreAnimation if you do not want to import the third part framework that someone suggested, but it is very simple to use CoreAnimation, and I suggest you study it because it is very powerful. Here is a simple way that can give you an idea. You can create it a little better as soon as you can get it to fit your needs:
There are 2 types in your viewcontroller:
@interface yourViewController : UIViewController {
Create them in the interface builder, either using code or, as you are used to. Make them coincide with each other, so that you only see the top screen and let buttomView remain behind it.
When the user clicks a button to display the menu:
-(IBAction)menuButtonPressed:(id)sender { // Set up animation with duration 0.5 seconds [UIView beginAnimations:@"ToggleMenu" context:nil]; [UIView setAnimationDuration:0.5]; // Alter position of topView CGRect frame = topView.frame; if (menuVisible) { frame.origin.x = 0; menuVisible = NO; } else { frame.origin.x = 300; //Play with this value menuVisible = YES; } topView.frame = frame; // Run animation [UIView commitAnimations]; }
Of course, you must implement your own UIView subclasses for "browsing facebook" and "menu view", etc. and use for topView and bottomView in the above example.
source share