PublishMusicView.swift 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // PublishMusicView.swift
  3. // RainbowPlanet
  4. //
  5. // Created by Christopher on 2019/6/23.
  6. // Copyright © 2019 RainbowPlanet. All rights reserved.
  7. // 音乐选择のView
  8. import UIKit
  9. class PublishMusicView: BaseView {
  10. typealias DismissViewClosure = () -> Void
  11. var dismissViewClosure : DismissViewClosure?
  12. override func setupViews() {
  13. self.backgroundColor = UIColor.clear
  14. // 添加毛玻璃效果,需使用frame设置位置
  15. let blurEffect = UIBlurEffect(style: .dark)
  16. let blurEffectView = UIVisualEffectView(effect: blurEffect)
  17. blurEffectView.frame = CGRect(x: CGFloat(0), y: kNavBarTotalHeight, width: kScreenWidth, height: kScreenHeight-kNavBarTotalHeight)
  18. addSubview(blurEffectView)
  19. addSubview(tableView)
  20. }
  21. override func setupLayouts() {
  22. tableView.snp.makeConstraints { (make) in
  23. make.top.equalToSuperview()
  24. make.left.right.bottom.equalTo(0)
  25. }
  26. }
  27. lazy var tableView: UITableView = {
  28. let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
  29. tableView.separatorStyle = .none
  30. tableView.backgroundColor = UIColor.clear
  31. tableView.dataSource = self
  32. tableView.delegate = self
  33. tableView.estimatedRowHeight = 50
  34. tableView.estimatedSectionFooterHeight = 0.000001
  35. tableView.estimatedSectionHeaderHeight = 0.000001
  36. return tableView
  37. }()
  38. }
  39. extension PublishMusicView: UITableViewDataSource, UITableViewDelegate {
  40. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  41. return 5
  42. }
  43. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  44. return UITableViewCell()
  45. }
  46. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  47. print("点击了----\(indexPath.row)")
  48. }
  49. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  50. return 50
  51. }
  52. func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  53. return 0
  54. }
  55. }