SITabBarMenu
示例
要运行示例项目,请克隆仓库,并先从Example目录中执行pod install
。
需求
安装
SITabBarMenu通过CocoaPods提供。要安装它,只需将以下行添加到您的Podfile中
pod 'SITabBarMenu'
手动
a. 下载示例项目 b. 将“SITabBarMenu”文件夹拖放到您的项目中
实现
-
导入SITabBarMenu
-
在您的Storyboard中添加一个UIView或在viewDidLoad中编程式添加UIView
-
使用以下代码在UIView中添加SIYATabView
titleArray = ["All","Movies","Songs","Album","Technologies","Sports","Trends"]
Let options = MenuOptions.init()
options.menuStyle = .normalTab
Let menuView = SITabMenuView(collectionViewframe: CGRect(x: 0, y: 0, width: Int(width), height: options.menuHeight), nameArray: titleArray,menuOption : options)//height of the tab bar should be same as yourview and need to assign options.menuHeight,(if not assign default height is 60) ,if you want change pls do option.menuHeight = 60,width you can add any size
menuView.delegate = self
yourview.addSubview(menuView)
- 菜单选项示例
options.backgroundColor = UIColor.white - (Change your Tab background color)
options.font = UIFont.systemFont(ofSize: 16) (Change your Title font )
options.menuHeight = 60 (Change your Menu Height)
options.selectedIndex = 0 (change your tab selection)
options.borderWidth = 1 (change your border width )
options.selectedMenuBgColor = UIColor.red (Change your selected menu background color)
options.selectedMenuBorderColor = UIColor.red(Change your selected menu border color)
options.selectedMenuShadowColor = UIColor.blue(Change your selected menu shadow color)
options.selectedTextColor = UIColor.white(Change your selected menu title text color)
options.isShadowNeedsSelectedMenu = true (If you no need shadow on selected menu change to false)
options.unSelectedMenuBgColor = UIColor.red (Change your unselected menu background color)
options.unSelectedMenuBorderColor = UIColor.red(Change your unselected menu border color)
options.unSelectedMenuShadowColor = UIColor.blue(Change your unselected menu shadow color)
options.unSelectedTextColor = UIColor.white(Change your unselected menu title text color)
options.isShadowNeedsUnSelectedMenu = false(If you no need shadow on unselected menu change to false)
- 标签菜单样式
options.menuStyle = .normalTab(NORMAL VIEW WITH OVAL SHAPED)
options.menuStyle = .squareTab / options.borderWidth = 0 (NORMAL VIEW WITH SQUARE SHAPED)
options.menuStyle = .squareTab (SQUARE VIEW)
options.menuStyle = .borderOvalTab (OVAL SHAPED BORDER VIEW)
options.menuStyle = .borderSquareTab (SQUARE SHAPED BORDER VIEW)
options.menuStyle = .ovalShapedTab (OVAL SHAPED VIEW)
-
为SITabMenu实现的委托方法(在此委托中,您将获得选择的标签索引)
func selectedMenu(index: Int){ centreLabel.text = self.titleArray[index] }
作者
siyadkpm, [email protected]
许可
SITabBarMenu 采用 MIT 许可。有关更多信息,请参阅 LICENSE 文件。