MKLEGYDrawerLayout 0.2.1

MKLEGYDrawerLayout 0.2.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2017年7月
SwiftSwift 版本3.0
SPM支持 SPM

Maintained by Madrit Kacabumi.



  • 作者:
  • devMadrit

MKLEGYDrawerLayout

MKLEGYDrawerLayout

一个双面菜单,类似于 Android DrawerLayout,使用简单且可定制。只需下载它,即可立即使用,所有内容都使用 panGesture recogniser 构建;

"Click to see image"

功能

  • [x] 双面菜单(左侧和右侧)
  • [x] 启用或禁用其中一个菜单(或两个都禁用)
  • [x] 只需一行代码即可添加内容(两个菜单)(约束自动添加)
  • [x] 更改大小、颜色、暗颜色等
  • [x] 移动偏移量

需求

1

安装

MKLEGYDrawerLayout 可通过CocoaPods获取。要安装它,只需将以下行添加到Podfile中

pod "MKLEGYDrawerLayout"

使用方法

  1. 导入库
import MKLEGYDrawerLayout

2.声明变量(最好是可选的)

 var sideMenu : DoubleSideMenu?

// 默认菜单都是启用的

3.您需要将其创建为视图(在 viewdidLoad 中执行的步骤)

  1. 声明捆绑包
// function avaible in extension in the library
let bundle = Bundle(identifier: "org.cocoapods.MKLEGYDrawerLayout")
  1. 创建视图
// function avaible in extension in the library
sideMenu = UIView.createView(attachTo: self.view, fromBundle: bundle) 
// self.view for all the view controller container or into another view 
  1. 现在将其添加到视图中(在故事板中创建一个 xib 或控制器,并将其添加到主容器或侧菜单中(它们只是视图))
   I   sideMenu?.setMainContentView (view : UIView, animated : Bool = false)
   //no need to add constraints , they are automatically added
   II   sideMenu?.addLeftMenu(view : UIView, animated: Bool = false) 
   III    sideMenu?.addRightMenu(view : UIView, animated: Bool = false)
  1. 尽情享受!

自定义

  1. 默认宽度为 280,但您可以为两个都更改
  sideMenu?.setLeftMenuWidth(width : CGFloat)
  sideMenu?.setRightMenuWidth(width : CGFloat)
  // do not use negative values as the will go back to default : 280
  1. 每次打开其中一个菜单时,假设是左侧菜单,主容器将有一个带 alpha 0.3(暗色)的黑色颜色,要更改颜色只需
sideMenu?.setMenuDimColor(colorHexString : "#BBBBBB")
  1. 如果您需要禁用任何菜单或如果某个已禁用而您想启用(默认都是启用的)只需
    sideMenu?.disableRightMenu()
    sideMenu?.disableLeftMenu()
    // OR
    sideMenu?.enableRightMenu()
    sideMenu?.enableLeftMenu()
  1. 在应用运行期间,如果您需要更改内容,那么
   sideMenu?.clearLeftMenu()
    //OR  

    sideMenu?. clearRightMenu() 
    //OR 
    // both of them :D   and anything else again
  1. 如果您需要以编程方式打开或关闭菜单,那么
  sideMenu?.closeAllMenus()
  sideMenu?.closeRightSideMenu()
  sideMenu?.closeLeftSideMenu()

  -- to open them --

  sideMenu?.openLeftSideMenu()
  sideMenu?.openRightSideMenu()
  1. 只用于检查的附加数据, 注意:请仅用于直接检查,不要更改!!
   sideMenu?.leftSideBarIsOpen : Bool
   sideMenu?.rightSideBarIsOpen : Bool

   sideMenu?.leftMenuIsEnabled : Bool
   sideMenu?.rightMenuIsEnabled : Bool

作者

Madrit Kacabumi(移动开发者),[email protected][email protected]

许可证

MKLEGYDrawerLayout采用GPL许可证,免费供所有人使用:)