WWRotaryWheel 0.2.0

WWRotaryWheel 0.2.0

Maintained by William-Weng.



  • By
  • 翁禹斌(William.Weng)

WWRotaryWheel

一個滾輪Tab按鈕

Swift 4.0 Version Platform License

一個滾輪Tab按鈕 (上傳至Cocoapods)

使用範例

IBOutlet

import UIKit
import WWRotaryWheel

class ViewController: UIViewController {

    @IBOutlet weak var myRotaryWheel: WWRotaryWheel!
    @IBOutlet weak var myLabel: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        myRotaryWheel.delegate = self
        // myRotaryWheel.imageSetting([#imageLiteral(resourceName: "list"), #imageLiteral(resourceName: "like"), #imageLiteral(resourceName: "meeting"), #imageLiteral(resourceName: "plus"), #imageLiteral(resourceName: "check-mark")])
        myRotaryWheel.titleSetting(["🐶", "🐭", "👻", "🦊", "🐼"])
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

extension ViewController: WWRotaryWheelDelegate {
    
    func wwRotaryWheel(_ wwRotaryWheel: WWRotaryWheel, clickedItemAt index: Int, for buttons: [UIButton]) {
        myLabel.text = index.description
    }
    
    func wwRotaryWheel(_ wwRotaryWheel: WWRotaryWheel, selectedItemAt index: Int, for buttons: [UIButton]) {
        for button in buttons { button.backgroundColor = .clear }
        buttons[index].backgroundColor = .yellow
    }
}