VTopLogo.swift 1.04 KB
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)
//        }
    }
}