1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //
- // BFIntroduceToolView.swift
- // BFRecordScreenKit
- //
- // Created by 胡志强 on 2021/11/26.
- //
- import Foundation
- import UIKit
- class BFIntroduceToolView: UIView {
-
- var choosedToolHandle:((UIView) -> Void)?
-
- fileprivate let toolImgs = ["", "", ""]
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- override init(frame: CGRect) {
- super.init(frame: CGRect(x: 0, y: 0, width: 40, height: 40*toolImgs.count))
- isUserInteractionEnabled = true
- clipsToBounds = true
-
- for i in 0 ..< toolImgs.count {
- let btn = UIButton(frame: CGRect(x: 0, y: i * 40, width: 40, height: 40))
- btn.backgroundColor = UIColor.randomColor()
- btn.setTitle("\(i)", for: .normal)
- btn.setImage(imageInRecordScreenKit(by: toolImgs[i]), for: .normal)
- btn.addTarget(self, action: #selector(toolAction(btn:)), for: .touchUpInside)
- addSubview(btn)
- }
-
-
-
- }
-
- @objc func toolAction(btn:UIButton) {
- let v = UILabel(frame: CGRect(x: 0, y: 0, width: 10, height: 40))
- v.backgroundColor = UIColor.white
- v.layer.shadowColor = UIColor.black.cgColor
- v.layer.shadowRadius = 3
-
- choosedToolHandle?(v)
-
-
- }
-
- }
|