真的很简单。首先,您需要制作一个位于可见光下的视图控制器。您可以在视图发送到背面是这样的:
[self.view sendSubviewToBack:menuViewController.view];
然后,你把你的导航栏左侧的菜单按钮,然后写一个处理程序有点像这样:
- (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);
}];
}
这是总体思路。您可能必须更改代码以反映您的视图层次结构等。
检查[此库](http://www.cocoacontrols.com/platforms/ios/controls/zuuirevealcontroller)。帮助过我!这是完成图书馆做这真的很好! – noctri
非常简单易用https://github.com/shivamchove/facebook_style_left_menus library –