Giter Site home page Giter Site logo

xlslidemenu's Introduction

XLSlideMenu

实现功能

  • 滑动显示左右菜单(支持快速滑动)
  • 调用方法显示左右菜单
  • 支持UINavigationController、UItabbarController,即UIViewController及其子类作为Window的根控制器
  • 滑动区域为界面两侧,不会和界面中的滚动视图发生冲突,并可自定义相应区域大小
  • 滑动只在NavigationController的个控制器显示时才会触发,其他自控制器不会触发菜单滑动方法

显示效果

示例图中的QQ界面只是截图

使用方法

1、创建方法:

(1)、导入头文件:

#import "XLSlideMenu.h"

(2)、创建菜单并设置成window的rootviewControler

XLSlideMenu *slideMenu = [[XLSlideMenu alloc] initWithRootViewController:rootNav];
//设置左右菜单
slideMenu.leftViewController = leftVC;
slideMenu.rightViewController = rightVC;
self.window.rootViewController = slideMenu;

2、使用方法:

(1)、显示左菜单

[self.xl_sldeMenu showLeftViewControllerAnimated:true];

(2)、显示右菜单

[self.xl_sldeMenu showRightViewControllerAnimated:true];

(3)、显示主界面

[self.xl_sldeMenu showRootViewControllerAnimated:true];

(4)、获取菜单宽度

self.xl_sldeMenu.menuWidth

(5)、获取留白宽度

self.xl_sldeMenu.emptyWidth

(6)、关闭滑动功能

self.xl_sldeMenu.slideEnabled = false;

(7)、跳转新界面

  • 判断RootViewController类型

  • 第一种情况:如果是UINavigationController就直接push

UINavigationController *nav = (UINavigationController *)self.xl_sldeMenu.rootViewController;
[nav pushViewController:newVc animated:false];
  • 第二种情况:如果是Tabbar就找到Tabbar的selectedViewController执行Push动作
UITabBarController *tabBarController = (UITabBarController *)self.xl_sldeMenu.rootViewController;
UINavigationController *nav = (UINavigationController *)tabBarController.selectedViewController;
[nav pushViewController:newVc animated:true];

个人开发过的UI工具集合 XLUIKit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.