Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone facebook side menu using objective c [duplicate]

Possible Duplicate:
What's the best way to develop a sideswipe menu like the one in Facebook's new iOS app?

The facebook iphone app has a new side menu,
screen
(source: tapscape.com)

Does anyone know how i can implement this feature in my iphone application and using objective c?

like image 315
Diptesh Avatar asked Nov 03 '11 06:11

Diptesh


1 Answers

It's pretty simple really. First, you need to make a view controller that sits under the one that's visible. You can send that view to the back like this:

[self.view sendSubviewToBack:menuViewController.view]; 

Then, you put a menu button on the left side of your navigation bar, and write a handler kind of like this:

- (void)menuButtonPressed:(id)sender {      CGRect destination = self.navigationController.view.frame;      if (destination.origin.x > 0) {         destination.origin.x = 0;     } else {         destination.origin.x += 254.5;     }      [UIView animateWithDuration:0.25 animations:^{          self.navigationController.view.frame = destination;              } completion:^(BOOL finished) {          self.view.userInteractionEnabled = !(destination.origin.x > 0);      }]; } 

That's the general idea. You may have to change the code to reflect your view hierarchy, etc.

like image 173
greenisus Avatar answered Sep 29 '22 13:09

greenisus