测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可 | MIT |
发布上次发布 | 2017年3月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 JonyFang 维护。
AnimatedDropdownMenu 是一个干净的界面下拉菜单,当您点击导航标题时,它将显示与导航相关的项目列表。
类型 01 | 类型 02 | 类型 03 |
---|---|---|
类型 04 | 类型 05 | 类型 06 |
类型 07 | 类型 08 | 类型 09 |
要运行示例项目,请克隆仓库,然后在 Xcode 中启动 Examples
git clone https://github.com/JonyFang/AnimatedDropdownMenu
cd AnimatedDropdownMenu/Examples
pod install --no-repo-update
open Examples.xcworkspace
导入您想要使用库的位置。
import AnimatedDropdownMenu
class ExampleViewController: UIViewController {
// MARK: - Properties
fileprivate var selectedStageIndex: Int = 0
fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
]
// MARK: Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
dropdownMenu.didSelectItemAtIndexHandler = {
[weak self] selectedIndex in
guard let strongSelf = self else {
return
}
strongSelf.selectedStageIndex = selectedIndex
//Configure Selected Action
}
navigationItem.titleView = dropdownMenu
}
}
一旦您设置了下拉菜单,您可以自定义菜单的界面。您可以为这些属性设置您喜欢的值
menuTitleColor
: 导航栏标题的字体。默认是 UIFont.systemFont(ofSize: 16.0)
menuArrowTintColor
: 箭头的着色。默认是 .darkGray
cellBackgroundColor
: 单元格背景的颜色。默认是 RGBA(216, 85, 96, 1)
cellSelectedColor
: 当选中单元格时的颜色。默认是 .clear
cellSeparatorColor
: 单元格分隔符的颜色。默认是 RGBA(255, 255, 255, 0.3)
cellTextColor
: 单元格内部文本的颜色。默认是 RGBA(255, 255, 255, 0.3)
cellTextSelectedColor
: 当选中单元格时,单元格内部文本的颜色。默认是 .white
cellTextAlignment
: 单元格内部文本的对齐方式。默认是 .center
如果在 AnimatedDropdownMenu 中遇到特定问题,或者有功能请求,或想分享评论,请在此处 创建一个新的问题。
AnimatedDropdownMenu 基于 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。