|
@@ -34,6 +34,26 @@ class BFMusicSearchController: BFBaseViewController {
|
|
|
return p
|
|
|
}()
|
|
|
|
|
|
+ lazy var searchTF : UITextField = {
|
|
|
+ let searchTF = UITextField()
|
|
|
+ let leftv = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 20))
|
|
|
+ let iv = UIImageView(frame: CGRect(x: 6, y: 0, width: 20, height: 20))
|
|
|
+ iv.contentMode = .scaleAspectFit
|
|
|
+ iv.image = imageInRecordScreenKit(by: "search")
|
|
|
+ leftv.addSubview(iv)
|
|
|
+ searchTF.leftView = leftv
|
|
|
+ searchTF.leftViewMode = .always
|
|
|
+ searchTF.clearButtonMode = .whileEditing
|
|
|
+ searchTF.placeholder = "歌名/歌手名"
|
|
|
+ searchTF.delegate = self
|
|
|
+ searchTF.returnKeyType = .search
|
|
|
+ searchTF.textColor = UIColor.white
|
|
|
+ searchTF.backgroundColor = UIColor.hexColor(hexadecimal: "#1d1d1d")
|
|
|
+ searchTF.layer.cornerRadius = 18
|
|
|
+
|
|
|
+ return searchTF
|
|
|
+ }()
|
|
|
+
|
|
|
lazy var musicTb : UITableView = {
|
|
|
let tb = UITableView(frame: .zero)
|
|
|
tb.delegate = self
|
|
@@ -45,6 +65,12 @@ class BFMusicSearchController: BFBaseViewController {
|
|
|
return tb
|
|
|
}()
|
|
|
|
|
|
+ override func viewDidAppear(_ animated: Bool) {
|
|
|
+ super.viewDidAppear(animated)
|
|
|
+
|
|
|
+ searchTF.becomeFirstResponder()
|
|
|
+ }
|
|
|
+
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
@@ -54,21 +80,7 @@ class BFMusicSearchController: BFBaseViewController {
|
|
|
closeBtn.addTarget(self, action: #selector(closeAction), for: .touchUpInside)
|
|
|
view.addSubview(closeBtn)
|
|
|
|
|
|
- let searchTF = UITextField(frame: CGRect(x: 62, y: statusBarHeight + 4, width: cScreenWidth - 62 - 18, height: 36))
|
|
|
- let leftv = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 20))
|
|
|
- let iv = UIImageView(frame: CGRect(x: 6, y: 0, width: 20, height: 20))
|
|
|
- iv.contentMode = .scaleAspectFit
|
|
|
- iv.image = imageInRecordScreenKit(by: "search")
|
|
|
- leftv.addSubview(iv)
|
|
|
- searchTF.leftView = leftv
|
|
|
- searchTF.leftViewMode = .always
|
|
|
- searchTF.clearButtonMode = .whileEditing
|
|
|
- searchTF.placeholder = "歌名/歌手名"
|
|
|
- searchTF.delegate = self
|
|
|
- searchTF.returnKeyType = .search
|
|
|
- searchTF.textColor = UIColor.white
|
|
|
- searchTF.backgroundColor = UIColor.hexColor(hexadecimal: "#1d1d1d")
|
|
|
- searchTF.layer.cornerRadius = 18
|
|
|
+ searchTF.frame = CGRect(x: 62, y: statusBarHeight + 4, width: cScreenWidth - 62 - 18, height: 36)
|
|
|
view.addSubview(searchTF)
|
|
|
|
|
|
view.addSubview(musicTb)
|