RotatoryWheel
使用
要运行示例项目,首先克隆仓库,然后从示例目录运行pod install
。
特性
- 此库允许您以如图所示的方式旋转轮子控件
- 它可以渲染为完整或半圆形
- 可以通过代理从选定的项中提取
- 可以通过缩放变量控制选定项的缩放比例
//You can initialize the wheel like this
let screenWidth = UIScreen.main.bounds.width
let containerWidth : CGFloat = screenWidth - 20 // can be any value
let wheel = F3RotaryWheel (frame: CGRect(x: (screenWidth - containerWidth)/2, y: -(containerWidth/2), width: containerWidth, height: containerWidth))
view.addSubview(wheel)
//or alternatively you can add the view in story board as in exmaple project and make its class F3RotatoryWheel
//Make sure you make the width and height equal
//To make it semicircular hide the other half from the screen by adjusting its constraints
//Then initialize the wheel like this
wheel.delegate = self
wheel.numberOfSections = 10
wheel.isSemiCircle = true
wheel.scale = 1.5
wheel.itemSize = CGSize(width: 70, height: 70) //Image size
wheel.rotateWheelByOffset = 0.1 //due to image size some time you have to tweak this offset when semi circle mode is selected
wheel.reloadView()
and implement these two delegates
func wheelDidChangeValue (newValue: String) {
print ("changed value to \(newValue)")
}
func imageNameForIndex(index: Int) -> String {
let imgName = "icon"+String(index)+".png"
return imgName
}
- 它支持iPad和iPhone分辨率以及所有方向
要求
Swift 4.1
XCode 9.3
安装
可以通过CocoaPods使用RotatoryWheel。要安装它,只需将以下行添加到您的Podfile中。
pod 'RotatoryWheel'
作者
Habib Ali,[email protected]
许可证
RotatoryWheel遵循MIT许可证。有关更多信息,请参阅LICENSE文件。