由Swift编写的简单高度可自定义的iOS组件,为您提供了另一种表示数据的方式。Round-Drop-Menu非常适合小型视觉信息集合。
RoundDropMenu可以通过CocoaPods获得。要安装它,只需在Podfile中添加以下行
pod 'RoundDropMenu'
Round-Drop-Menu的使用与UITableView
或UICollectionView
非常相似。您只需
RoundDropMenu
放置在您的View Controller中。RoundDropMenuDataSource
并实现两个方法numberOfDropsInRoundDropMenu(menu: RoundDropMenu) -> Int
roundDropMenu(menu: RoundDropMenu, dropViewForIndex index: Int) -> DropView
RoundDropMenu
的dataSource
设置为您的View Controller。RoundDropMenuDelegate
以获取方法roundDropMenu(menu: RoundDropMenu, didSelectDropWithIndex index: Int)
您可以通过设置以下属性来改变菜单的显示效果
DropView
color
- 默认颜色highlitedColor
- 高亮状态的视图颜色。RoundDropMenu
color
- 菜单中心椭圆的颜色。offset
- 视图边界到椭圆的填充。maxDropRadius
- 菜单中心滴落的半径。minDropRadius
- 滴落的最小半径。