Git Product home page Git Product logo

kmustcti404 / fwsidemenu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from choiceyou/fwsidemenu

0.0 1.0 0.0 3.66 MB

侧滑控件:支持左、右滑动的侧滑菜单,可配置单侧滑动,同时可配置菜单宽度等,更多配置请参考”可设置参数“。参考了QQ用户体验:支持边缘侧滑,解决手势冲突问题(边缘范围可设置)。提供OC使用Demo。

Ruby 7.60% Swift 80.15% Objective-C 12.25%

fwsidemenu's Introduction

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

Platform  Language  License

支持pod导入:

use_frameworks!
pod 'FWSideMenu'
注意:
1、如出现 [!] Unable to find a specification for 'FWSideMenu' 错误 或 看不到最新的版本,
  可执行 pod repo update 命令更新一下本地pod仓库。
2、use_frameworks! 的使用:
(1)纯OC项目中,通过cocoapods导入OC库时,一般都不使用use_frameworks!
(2)纯swift项目中,通过cocoapods导入swift库时,必须使用use_frameworks!
(3)只要是通过cocoapods导入swift库时,都必须使用use_frameworks!
(4)使用动态链接库dynamic frameworks时,必须使用use_frameworks!

可设置参数:

/// 中间控制器
@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())

效果:

更新记录:

• v2.0.5:

  • 修复侧滑关闭过程中,在距离屏幕边缘小于等于5pt的位置松手时发生死屏现象;
  • 修复侧滑打开的状态下,拖动侧滑至关闭的的状态,发生死屏现象;
  • 优化点击关闭侧滑菜单过程中灰色层动画变化过程(动画更加自然,不会出现一闪的现象);

• v2.0.6:

  • 修复左右拖动菜单栏时可能会出现隐藏菜单的问题;

结尾语:

  • 使用过程中发现bug请issues或加入FW问题反馈群:670698309(此群只接受FW相关组件问题);
  • 有新的需求欢迎提出;

fwsidemenu's People

Contributors

choiceyou avatar

Watchers

 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.