GrandMenu 1.2.0

GrandMenu 1.2.0

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最新发布2018年10月
SPM支持 SPM

DuckDeck 维护。



GrandMenu 1.2.0

  • DuckDeck

GrandMenu

===

GrandMenu 是一个简单且易于使用的菜单工具

GrandMenu 是一个简单且易于使用的菜单工具,并提供 GrandTableMenu 供配套使用,两者结合可以实现类似网易新闻部分的效果

##【主要特色】

  • 菜单标题、颜色、字体以及下面的栏可以完全自定义
  • 菜单标题和栏的大小和位置完全自动分配
  • 可以自动调整表格的大小
  • 使用 Block 回调菜单的点击事件和表格的滚动事件

##【安装需求】

Xcode 9.0 和 iOS 8.0 (Swift 3.0 版本)

##【安装】

  • 如果你想使用 Cocoapods,只需 pod 'GrandMenu',然后安装即可

  • 如果你想使用文件,只需将 GrandMenu.swift、GrandMenuItem.swift 和 GrandMenuTable.swift 拷贝到你的项目中即可

##【如何使用】 请参阅以下代码

grandMenu = GrandMenu(frame:CGRect(x: 0, y: 64, width: UIScreen.mainScreen().bounds.size.width, height: 40) , titles:  ["First","Second","Third","Fouth","Fifth"]) //init the GrandMenu and assign the menu titles, and also you can assign titles later
grandMenu.arrItemsTitle =  ["First","Second","Third","Fouth","Fifth"]
grandMenu?.itemSeletedColor = UIColor.blueColor() //set the menu title color when it's selected 
grandMenu?.itemColor = UIColor.greenColor() //set the menu title color when it's not selected
grandMenu?.itemFont = 14//set the menu title font when it's not selected
grandMenu?.itemSelectedFont = 18//set the menu title font when it's  selected
grandMenu?.sliderBarHeight = 5//set the menu title slider bar height 
grandMenu?.sliderBarLeftRightOffset = 15//set the menu title silder bar left right offset 
grandMenu?.selectMenu = {[weak self](item:GrandMenuItem, index:Int) in
        self?.grandMenuTable?.contentViewCurrentIndex = index
 }

view.addSubview(grandMenu!) // then add the menu
 arrControllers = [UIViewController]() //init the viewControllers array
 let vc1 = Controller1()
 let vc2 = Controller2()
 let vc3 = Controller3()
 let vc4 = Controller4()
 let vc5 = Controller5()
 arrControllers?.append(vc1)
 arrControllers?.append(vc2)
 arrControllers?.append(vc3)
 arrControllers?.append(vc4)
 arrControllers?.append(vc5) //add the viewcontrollers you want
 grandMenuTable = GrandMenuTable(frame: CGRect(x: 0, y: grandMenu!.frame.maxY, width: UIScreen.main.bounds.size.width, height: view.frame.size.height - 104), childViewControllers: arrControllers!, parentViewController: self) //use the arrControllers to init the GrandTable
grandMenuTable?.scrollToIndex = {[weak self](index:Int)in
       self?.grandMenu?.selectSlideBarItemAtIndex(index)
}

}
 view.addSubview(grandMenuTable!) //add the GrandTable
//in the ViewControllers you added, you must add this code.
 override func viewWillLayoutSubviews() { // in the viewControllers  you need set table frame, and this is very important
    tb?.frame = self.view.bounds
 }

参考 Demo 项目可以更好地理解 GrandMenu 的使用

add -DDEBUG location

add -DDEBUG location

add -DDEBUG location

【联系】

有任何问题请联系我:[email protected],我将很乐意帮助解决