APLSlideMenu 0.2.0

APLSlideMenu 0.2.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2016年3月

Michael KamphausencgTino RachuiMathias KöhnkeMathias KoehnkeNico SchümannHeiko WichmannStephan LernerFamara Kassama 维护。



  • Christopher Groß、Tobias Conradi、Tino Rachui、Michael Kamphausen、Thorsten Siebenborn、Kay J.、Ivan Ziryanov、Emmanuel Castellani 和 Nico Schümann

类似于 Facebook 应用程序中的滑动汉堡菜单

  • 支持左右滑动菜单
  • 支持可选的滑动手势支持
  • 支持设备方向
  • 支持在横向模式下在 iPad 上持续显示滑动菜单,类似于 UISplitViewController
  • 支持 iOS 7 视图控制器基于的状态栏外观
  • 支持故事板设置
  • 基本辅助功能支持

iPhone Screenshot iPad Screenshot

安装

使用

APLSlideMenuViewController 应该是,但不必是根视图控制器。它通过 Storyboard 初始化或在您的 AppDelegate 中或通过 APLSlideMenu 子类中的代码初始化。

Storyboard

只需将自定义券如 APLSlideMenuContentSegueAPLSlideMenuLeftMenuSegueAPLSlideMenuRightMenuSegue 从您的 APLSlideMenuViewController 拖到您的内容和菜单视图控制器,并将券标识符命名为 contentleftMenurightMenu

如果您正在使用异常断点并且您没有使用所有三个券,异常断点将中断执行。为了避免这种情况,您可能希望使用符号断点代替。使用符号 objc_exception_throw 和条件

(BOOL)(!(BOOL)[[(NSException *)$r0 reason] hasSuffix:@"has no segue with identifier 'leftMenu'"] && !(BOOL)[[(NSException *)$r0 reason] hasSuffix:@"has no segue with identifier 'rightMenu'"] && !(BOOL)[[(NSException *)$r0 reason] hasSuffix:@"has no segue with identifier 'content'"])

当在模拟器上测试而不是在设备上时,您需要禁用此符号断点并添加另一个,将条件中的每个 $r0 替换为 $eax

代码

导入头文件

#import "APLSlideMenuViewController.h"

初始化示例

id rootViewController = self.window.rootViewController;

if ([rootViewController isKindOfClass:[APLSlideMenuViewController class]]) {
    APLSlideMenuViewController *slideViewController = rootViewController;

    // first: configure the slide menu
    slideViewController.bouncing = YES;
    slideViewController.gestureSupport = APLSlideMenuGestureSupportDrag;

    // second: set the leftMenuViewController and / or rightMenuViewController
    slideViewController.leftMenuViewController = [MyLeftMenuViewController new];
    slideViewController.rightMenuViewController = [MyRightMenuViewController new];

    // third: set the contentViewController
    slideViewController.contentViewController = [MyContentViewController new];

} else {
    NSLog(@"Ups, this shouldn't happen");
}

从早期版本迁移

从 0.0.x

  • 将废弃的 menuViewController 属性重命名为 leftMenuViewController
  • 将废弃的 showMenu: 方法调用重命名为 showLeftMenu:
  • 将废弃的 switchMenu: 方法调用重命名为 switchLeftMenu: