1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // BFThumImageView.swift
- // BFRecordScreenKit
- //
- // Created by 胡志强 on 2022/2/9.
- //
- import Foundation
- import UIKit
- class BFThumImageView: UIView {
-
- var isHiddenBord = false{
- didSet{
- if let v = self.viewWithTag(12333){
- v.isHidden = isHiddenBord
- }
- }
- }
-
- fileprivate let iv : UIImageView = {
- let iv = UIImageView()
- iv.frame = CGRect(x: 0, y: 0, width: 70, height: 50)
- iv.contentMode = .scaleAspectFill
- return iv
- }()
-
- var image: UIImage? {
- didSet{
- iv.image = image
- }
- }
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- addIndicationView()
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- init(image: UIImage?) {
- super.init(frame: CGRect.zero)
- self.image = image
- self.clipsToBounds = true
- addIndicationView()
- }
-
- func addIndicationView(){
- subviews.forEach { v in
- v.removeFromSuperview()
- }
-
- addSubview(iv)
-
- let bottomView = UIView()
- bottomView.backgroundColor = ThemeStyleColor
- addSubview(bottomView)
- bottomView.snp.makeConstraints { make in
- make.left.bottom.width.equalToSuperview()
- make.height.equalTo(6)
- }
-
- let line = UIView()
- line.backgroundColor = UIColor.init(white: 0, alpha: 0.5)
- line.tag = 12333
- addSubview(line)
- line.snp.makeConstraints { make in
- make.right.top.bottom.equalToSuperview()
- make.width.equalTo(1.5)
- }
- }
- }
|