VTopLogo.swift
1.04 KB
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
import Foundation
import UIKit
@IBDesignable class VTopLogo: UIView{
@IBOutlet weak var imvLogo: UIImageView!
var leftBtnClick: (() -> Void)?
override init(frame: CGRect) {
super.init(frame: frame)
xibSetup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
xibSetup()
}
func xibSetup() {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: "VTopLogo", bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView
view.frame = bounds
view.autoresizingMask = [UIViewAutoresizing.flexibleWidth, UIViewAutoresizing.flexibleHeight]
addSubview(view)
let tap = UITapGestureRecognizer.init(target: self, action: #selector(VTopLogo.logoClick))
imvLogo.addGestureRecognizer(tap)
}
func logoClick() {
leftBtnClick?()
// else{
// self.parentViewController?.dismiss(animated: true, completion: nil)
// }
}
}