Skip to content

LeBzul/LBZSpinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platform Language

LBZSpinner (Supports Swift 3)

Simple Spinner with dropdown-list for iOS (like android)

Demo

View live demo in Appetize : https://appetize.io/app/m4gbf5ghpyh4bw4vpdcjxgk218?device=iphone5s&scale=75&orientation=portrait&osVersion=9.2

Installation / Usage

Import LBZSpinner.swift in your project (or use example project)

Create LBZSpinner in code :

let spinnerCode = LBZSpinner(frame: CGRect(x: 90,y: 30,width: 180,height: 45))
self.view.addSubview(spinnerCode)
Configure Spinner Style :
spinnerCode.decoratedSpinner(UIColor.purpleColor(), lineColor: UIColor.brownColor(), text: "Choose value")

(Use nil parameter for default value)

Configure Dropdown-list Style :
spinnerCode.decoratedDropDownList(UIColor.lightGrayColor(), textColor: UIColor.redColor(), withStroke: true, strokeSize: 5, strokeColor: nil)

(Use nil parameter for default value)

Create LBZSpinner in IB :

In Storyboard, place a simple UIView in your ViewController

Set "Custom class" in "Identity inspector" with LBZSpinner :

Img

Configure style dropdowlist and spinner :

Img

LBZSpinner show in viewcontroller :

Img

Configure Dropdown-list value :

let listCode = ["Books","Video","Streaming","Download","Upload"]
spinnerCode.updateList(listCode)

Configure Delegate

Use LBZSpinnerDelegate for event return :

Declare use LBZSpinnerDelegate :
class ViewController: UIViewController, LBZSpinnerDelegate 
Set Spinner delegate :
spinnerCode.delegate = self
Event return method :
func spinnerChoose(spinner:LBZSpinner, index:Int,value:String) {
    print("Spinner : \(spinner) : { Index : \(index) - \(value) }")
}
Get/Set index :

Get actual selected index :

var index = spinnerBot.selectedIndex

if no selected value :

if spinnerBot.selectedIndex == LBZSpinner.INDEX_NOTHING {
    print("NOTHING VALUE")
}

Set actual selected index :

spinnerBot.changeSelectedIndex(1)

Images example

Example 1 :

Img

Img

Example 2 :

Img

Img

Example of dip type and LeBzul type

spinner demo

Author

Guillian Drouin, drouingui@gmail.com

Dip kasyap, dpd.ghimire@gmail.com (dip type added)

License

LBZSpinner is available under the Apache license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages