[英]MMDrawerController keep center view controller completely visible
I've got an MMDrawerController in the iPhone version of my app and I love it! 我的应用程序的iPhone版本中有一个MMDrawerController,我喜欢它! I'm working on my iPad implementation now.
我正在研究iPad的实现。 I would like to keep the left drawer open all/most the time and use it sort of like a split view controller.
我想让左抽屉在所有时间/大部分时间都保持打开状态,并像拆分视图控制器一样使用它。 (I'm not using a real split view controller because so many problems come along with those, I'm tired of fighting with them.) When the left drawer is open, however, the center view controller is just moved off to the side as normal.
(我没有使用真正的拆分视图控制器,因为伴随着这些问题太多了,我已经厌倦了与之抗争。)但是,当左侧抽屉打开时,中央视图控制器只是移到了侧面像平常一样。
Is there a way to configure the MMDrawerController so that the center view isn't pushed off to the side, but instead just sets a smaller width on the center controller so that it is still entirely visible on the screen? 有没有一种方法可以配置MMDrawerController,以使中心视图不会被推到侧面,而只是在中心控制器上设置一个较小的宽度,以便它仍在屏幕上完全可见?
Any suggestions are appreciated! 任何建议表示赞赏!
If you want the drawer open all of the time, then simply subtract the drawer width from the centre view controller's view. 如果要一直打开抽屉,则只需从中央视图控制器的视图中减去抽屉宽度即可。 Does that not work?
那行不通吗?
EDIT: So it seems that MMDrawerController uses its own centre view container. 编辑:所以看来MMDrawerController使用了自己的中心视图容器。 Instead of messing with internal library code, what you can do is use a dummy centre view controller.
您可以使用虚拟的中心视图控制器来代替内部代码的混乱。 And then create a navigation controller with your actual centre view controller.
然后使用实际的中心视图控制器创建导航控制器。 Adjust the frame for the navigation view controller's view and add it as a child view controller to the dummy centre view controller.
调整导航视图控制器视图的框架,并将其作为子视图控制器添加到虚拟中心视图控制器。
The catch here is that every time you push a new view controller, you will have to adjust its frame to account for the side drawer's width. 这里要注意的是,每次按下新的视图控制器时,都必须调整其框架以适应侧面抽屉的宽度。
Here's the link to the above in code: https://bitbucket.org/pallakgrewal/mmdrawersplitcontroller Be sure to update 这是上面的代码链接: https : //bitbucket.org/pallakgrewal/mmdrawersplitcontroller确保更新
[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
to MMCloseDrawerGestureModeNone in the app delegate. 到应用程序委托中的MMCloseDrawerGestureModeNone。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.