//
//  BottomCancelItem.swift
//  PaiaiUIKit
//
//  Created by FFIB on 2019/1/21.
//  Copyright © 2019 FFIB. All rights reserved.
//

import UIKit

final class BottomCancelItem: AlertItem {

    static var `default`: BottomCancelItem {
        return BottomCancelItem()
    }

    init() {
        super.init(frame: CGRect.zero)
        initProperty()
    }

    override func didMoveToWindow() {
        installTarget()
    }

    private func initProperty() {
        titleLabel?.numberOfLines = 0
        titleLabel?.font = UIFont.systemFont(ofSize: 17)
        backgroundColor = UIColor.white
        setTitleColor(UIColor(r: 51, g: 51, b: 51), for: .normal)
    }

    private func installTarget() {
        guard let vc = getSuperViewController() else { return }
        addTarget(vc, action: #selector(AlertViewController.disappear), for: .touchDown)
    }
}