ITRAirSideMenu

加入收藏
已有 1 人收藏

介绍:
    抽屉式导航菜单

    

    系统环境:

    Xcode 6 +

    Apple LLVM compiler

    iOS 7.0 or higher

    ARC

    

    安装:

    1、cocoapods

    若没有安装cocapods ,可以使用下面的方法进行安装:

    $ [sudo] gem install cocoapods

    $ pod setup

    

    安装好 cocoapods 之后,可以将当前路径移动的项目路径下,然后 编辑 podfile。

    $ cd /path/to/MyProject

    $ touch Podfile

    $ edit Podfile

    

    podfile 中添加以下一行

    platform :ios, '6.0'

    pod 'ITRAirSideMenu', '~> 1.0.0'

    

    然后执行 pod 命令

    $ pod install

    

    打开 MyProject.xcworkspace 文件(MyProject为您的项目名称),即可以安装完成。

    

    2、手动安装:

    直接将下载的文件夹 ITRAirSideMenu 拖入的您的项目中。

    

    使用范例:

    在项目的 AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 中创建主内容控制器和侧滑菜单控制器

    

    // Create content and menu controllers

    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:[ITRFirstViewController controller]];

    ITRLeftMenuController *leftMenuViewController = [ITRLeftMenuController controller];

    

    // Create side menu controller

    ITRAirSideMenu *itrAirSideMenu = [[ITRAirSideMenu alloc] initWithContentViewController:navigationController leftMenuViewController:leftMenuViewController];

    

    itrAirSideMenu.backgroundImage = [UIImage imageNamed:@"menu_bg"];

    

    // Make it a root controller

    self.window.rootViewController = itrAirSideMenu;

    

    手动将控制器 present 出来:

    [self.itrAirSideMenu presentLeftMenuViewController];

    or using a pan gesture recognizer

    

    点击菜单切换不同的主内容控制器

    #import "ITRAirSideMenu.h"

    ....

    [self.itrAirSideMenu setContentViewController:viewController animated:YES];

    [self.itrAirSideMenu hideMenuViewController];

测试环境:
  [Code4App]编译测试
效果图:
  • iOS / iPhone / iPad 抽屉式导航菜单<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;系统环境:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;Xcode 6 +<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;Apple LLVM compiler<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;iOS 7.0 or higher<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;ARC<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;安装:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;1、cocoapods<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;若没有安装cocapods ,可以使用下面的方法进行安装:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;$ [sudo] gem install cocoapods<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;$ pod setup<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;安装好 cocoapods 之后,可以将当前路径移动的项目路径下,然后 编辑 podfile。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;$ cd /path/to/MyProject<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;$ touch Podfile<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;$ edit Podfile<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;podfile 中添加以下一行<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;platform :ios, '6.0'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pod 'ITRAirSideMenu', '~> 1.0.0'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;然后执行 pod 命令<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;$ pod install<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;打开 MyProject.xcworkspace 文件(MyProject为您的项目名称),即可以安装完成。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;2、手动安装:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;直接将下载的文件夹 ITRAirSideMenu  拖入的您的项目中。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;使用范例:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;在项目的 AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 中创建主内容控制器和侧滑菜单控制器<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Create content and menu controllers<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:[ITRFirstViewController controller]];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;ITRLeftMenuController *leftMenuViewController = [ITRLeftMenuController controller];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Create side menu controller<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;ITRAirSideMenu *itrAirSideMenu = [[ITRAirSideMenu alloc] initWithContentViewController:navigationController leftMenuViewController:leftMenuViewController];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;itrAirSideMenu.backgroundImage = [UIImage imageNamed:@"menu_bg"];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Make it a root controller<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;self.window.rootViewController = itrAirSideMenu;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;手动将控制器 present 出来:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[self.itrAirSideMenu presentLeftMenuViewController];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;or using a pan gesture recognizer<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;点击菜单切换不同的主内容控制器<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;#import "ITRAirSideMenu.h"<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;....<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[self.itrAirSideMenu setContentViewController:viewController animated:YES];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[self.itrAirSideMenu hideMenuViewController];
代码评论:
登录后方可评论

  
  • 暂无评论