I have implemented a slide menu, but I need a sliding effect just like on facebook. I came across the following post in stackoverflow:
iphone facebook side menu using target c
That I want to implement the solution given by greenisus (voted 15 times), but I had a problem with the implementation of this, the same concern was raised by Bot in the comments to his answer. "@greenisus I'm confused about how you sent the menu to the back? When I do this, it just shows the menu from the black side." to which I did not answer.
The text of his answer for reference:
It is pretty simple. First, you need to create a view controller that is below the visible. You can put this view in the background as follows:
[self.view sendSubviewToBack:menuViewController.view]
Then you place the menu button on the left side of the navigation panel and record the view of the handler as follows:
- (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); }]; }
This is a general idea. You may need to modify the code to reflect the hierarchy of your view, etc.
I just want to know when we should use the following method, the second method is simple and works fine, but does not display it below it.
[self.view sendSubviewToBack:menuViewController.view]
Look for some pointers or a solution for the proper execution of the above code.
ios objective-c iphone uiviewcontroller uiview
mangesh
source share