简体   繁体   English

MMDrawerController使中心视图控制器完全可见

[英]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.

相关问题 中心控制器具有Scroll View时MMDrawerController的平移手势行为 - MMDrawerController pan gesture behaviour when center controller has Scroll View MMdrawerCOntroller-带有过渡的中心视图中的加载视图 - MMdrawerCOntroller - Load view in center view with transition MMDrawerController每个视图控制器上都有滑块 - MMDrawerController having slider on each View Controller 在自定义Segue上保持第一个View Controller可见 - Keep first View Controller visible on custom Segue MMDrawerController:将相同的实例leftViewController用于两个单独的中心View Controller - MMDrawerController: Using the same instance leftViewController for two separate center View Controllers iOS MMDrawerController Objective-C登录视图控制器 - iOS MMDrawerController objective-c login view controller 当我单击leftViewcontroller单元格时,MMDrawerController导航到另一个视图控制器 - MMDrawerController navigating to another view controller when I click on the leftViewcontroller cell 使用自定义容器视图控制器(MMDrawerController)的iOS状态还原 - iOS State Restoration with custom container view controller (MMDrawerController) 将视图放在MMDrawerController顶部 - Putting a View on Top of MMDrawerController MMDrawerController,以“登录”视图为第一视图 - MMDrawerController with Login View as first view
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM