-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKeyboardViewController+Nav.swift
62 lines (51 loc) · 1.31 KB
/
KeyboardViewController+Nav.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
//
// KeyboardViewController+Nav.swift
// KeyboardWork
//
// Created by Stan Hu on 2022/5/7.
//
import UIKit
extension KeyboardViewController{
func push(v:UIView){
if containerView == nil{
containerView = UIView()
view.addSubview(containerView!)
containerView?.snp.makeConstraints({ make in
make.edges.equalTo(0)
})
}
containerView?.addSubview(v)
v.snp.makeConstraints { make in
make.edges.equalTo(0)
}
removeKeyboardView()
}
func pop(){
if let last = containerView?.subviews.last{
last.removeFromSuperview()
}
if containerView?.subviews.count == 0{
popToKeyboard()
}
}
func popToKeyboard(){
if containerView != nil{
containerView?.subviews.forEach{$0.removeFromSuperview()}
containerView?.removeFromSuperview()
containerView = nil
}
addKeyboard()
}
func addSwitchKeyboardView(){
let v = SwitchKeyboardView()
push(v: v)
}
func addSettingView(){
let v = KeyboardSettingView()
push(v: v)
}
func addPasteboardView(){
let v = PasteboardView()
push(v: v)
}
}