-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewController.swift
77 lines (52 loc) · 1.61 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// ViewController.swift
// myDropDownMenu
//
// Created by Batuhan Saygili on 1.10.2018.
// Copyright © 2018 koust. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var demoTextField: UITextField!
@IBOutlet weak var didSelectName: UILabel!
let VC = myDropDownController()
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
VC.yourTextField = demoTextField
VC.yourList = ["Trail Version","Hey","Apple0","Apple1","Las Vegas","Last","Arr","Rr"]
VC.yourView = self.view
VC.alwaysOpen = false
VC.cornerRadius = 5
VC.create(position: .top,positonAuto: true)
VC.didSelect { (listName, index) in
self.demoTextField.text = listName
print(listName)
print(index)
self.didSelectName.text = listName + " - Index: \(index)"
self.filterList()
}
VC.willOpen {
print("will Show")
}
VC.didLoad {
print("did Load")
}
VC.didClose {
print("did Close")
}
}
func filterList(){
VC.filterList { (filterList) in
print(filterList)
}
}
@IBAction func showAction(_ sender: Any) {
VC.show()
}
@IBAction func closeAction(_ sender: Any) {
VC.close()
}
}