Git Product home page Git Product logo

fwsidemenu's Introduction

IOS之侧滑控件 -- OC/Swift4.0

Platform  Language  License

支持pod导入:

pod 'FWSideMenu'
注意:如出现 Unable to find a specification for 'FWSideMenu' 错误,可执行 pod repo update 命令。

可设置参数:

/// 中间控制器
@objc public var centerViewController: UIViewController?
/// 左侧侧滑控制器
@objc public var leftMenuViewController: UIViewController?
/// 右侧侧滑控制器
@objc public var rightMenuViewController: UIViewController?

/// 拖动状态
@objc public var sideMenuPanMode: FWSideMenuPanMode = .defaults
/// 当前菜单状态
@objc public var sideMenuState: FWSideMenuState = .closed

/// 左菜单宽度
@objc public var leftMenuWidth: CGFloat = UIScreen.main.bounds.width * 0.8
/// 右菜单宽度
@objc public var rightMenuWidth: CGFloat = 270.0

/// 左、右菜单是否跟随滑动
@objc public var menuSlideAnimationEnabled: Bool = true
/// 左(右)菜单滑动相对于本身的宽度值的 1/menuSlideAnimationFactor
@objc public var menuSlideAnimationFactor: CGFloat = 3.0

简单使用:(注:可下载demo具体查看,分别有OC、Swift的demo)

/// 类初始化方法
///
/// - Parameters:
///   - centerViewController: 中间控制器(即当前您的主控制器)
///   - leftMenuViewController: 左侧菜单控制器,可为nil
///   - rightMenuViewController: 右侧菜单控制器,可为nil
/// - Returns: self
@objc open class func container(centerViewController: UIViewController?, 
                              leftMenuViewController: UIViewController?, 
                             rightMenuViewController: UIViewController?) -> FWSideMenuContainerViewController

OC:

ViewController *vc = [[ViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    
[FWSideMenuContainerViewController containerWithCenterViewController: nav 
                                              leftMenuViewController:[[MenuViewController alloc] init] 
                                             rightMenuViewController:nil];

Swift:

FWSideMenuContainerViewController.container(centerViewController: FWTabBarController(),
                                          leftMenuViewController: SideMenuViewController(), 
                                         rightMenuViewController: SideMenuViewController())

效果:

结尾语:

  • 使用过程中有任何问题或者新的需求都可以issues我哦;
  • 欢迎关注本人更多的UI库,谢谢;

fwsidemenu's People

Contributors

choiceyou avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.