Created
July 27, 2015 13:12
-
-
Save chenzeyu/6d19a343ffc8d6530fd0 to your computer and use it in GitHub Desktop.
CZPicker Swift Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// czpswift | |
// | |
// Created by chenzeyu on 21/7/15. | |
// Copyright (c) 2015 chenzeyu. All rights reserved. | |
// | |
import UIKit | |
import CZPicker | |
class ViewController: UIViewController, CZPickerViewDelegate, CZPickerViewDataSource { | |
@IBAction func pressed(sender: AnyObject) { | |
let picker = CZPickerView(headerTitle: "Header", cancelButtonTitle: "Cancel", confirmButtonTitle: "Confirm") | |
picker.delegate = self | |
picker.dataSource = self | |
picker.needFooterView = true | |
picker.show() | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
func numberOfRowsInPickerView(pickerView: CZPickerView!) -> Int { | |
return 2 | |
} | |
func czpickerView(pickerView: CZPickerView!, titleForRow row: Int) -> String! { | |
return "option \(row)"; | |
} | |
func czpickerView(pickerView: CZPickerView!, didConfirmWithItemAtRow row: Int){ | |
NSLog("Clicked \(row)") | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment