-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewController.swift
43 lines (36 loc) · 1.49 KB
/
ViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// ViewController.swift
// LXKAreaPicker
//
// Created by 李现科 on 16/6/5.
// Copyright © 2016年 李现科. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let areaPicker = LXKFullAreaPicker<[String:AnyObject]>(frame: view.frame)
let helper = LXKAreaPickerHelper()
areaPicker.areaPicker.numberOfSections = { (areaPicker: LXKAreaPicker) -> Int in
return helper.numberOfSectionsInAreaPicker(areaPicker)
}
areaPicker.areaPicker.itemsInSection = { (section: Int) -> [[String:AnyObject]] in
return helper.areaPicker(areaPicker.areaPicker, itemsInSection: section)
}
areaPicker.areaPicker.didSelectItem = { (indexPath: NSIndexPath) in
if indexPath.section == 2 {
let province = areaPicker.areaPicker.seletedItemInSection(0) as? [String:String]
let city = areaPicker.areaPicker.seletedItemInSection(1) as? [String:String]
let area = areaPicker.areaPicker.seletedItemInSection(2) as? [String:String]
print(province, city, area)
// areaPicker.dismiss()
}
}
view.addSubview(areaPicker)
// 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.
}
}