KYSelectBox
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
platform :ios, '12.0'
Installation
KYSelectBox is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'KYSelectBox'
Usage
//1. Setup Items for Buttons
let categories = ["Item 1", "Item 2", "Item 3"]
let mainColor = UIColor(red: 95.0/255.0, green: 149.0/255.0, blue: 149.0/255.0, alpha: 1.0)
let selectBoxWidth = CGFloat(self.view.frame.width * 0.8)
let selectBoxHeight = CGFloat(80)
//2. Configure SelectBox
self.selectBox = KYSelectBox(frame: CGRect(x: 0,y: 0,width: selectBoxWidth, height: selectBoxHeight))
.setItems(categories)
.setMainColor(mainColor)
.setVisibleShadow(true)
.setAnimationTime(0.3)
.setAnimationOption(.curveEaseInOut)
.setFont(.boldSystemFont(ofSize: 14))
.build()
//3. Configure SelectBox CallBack Method
selectBox.onButtonSelected = { [unowned self] index in
print("onButtonSelected index : \(index)")
self.indexLbl.text = "Index \(index) Selected"
}
//4. Configure SelectBox Position
self.selectBox.center = self.view.center
self.view.addSubview(selectBox)
Author
Gangyeol Kim, [email protected]
License
KYSelectBox is available under the MIT license. See the LICENSE file for more info.