问题描述
我设置了带有操作表的表格视图。但是每当介绍操作表时我都会遇到问题。
这是代码和图像的一部分。
class MoviesTableViewController: UIViewController {
@IBOutlet weak var moviesTableView: UITableView!
private let actionSheet = UIAlertController(title: "정렬방식 선택",message: "영화를 어떤 순서로 정렬할까요?",preferredStyle: .actionSheet)
private var movies: Movies?
private var api: BoxOfficeAPI?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
moviesTableView.estimatedRowHeight = moviesTableView.rowHeight
moviesTableView.rowHeight = UITableView.automaticDimension
NotificationCenter.default.addobserver(self,selector: #selector(setData(_:)),name: .MoviesNotification,object: nil)
moviesTableView.delegate = self
moviesTableView.dataSource = self
configureRefreshControl()
api = BoxOfficeAPI(with: "https://connect-Boxoffice.run.goorm.io/movies?order_type=0",and: .Movies)
api?.request()
actionSheet.addAction(UIAlertAction(title: "예매율",style: .default,handler: { _ in
}))
actionSheet.addAction(UIAlertAction(title: "큐레이션",handler: { _ in
}))
actionSheet.addAction(UIAlertAction(title: "개봉일",handler: { _ in
}))
actionSheet.addAction(UIAlertAction(title: "취소",style: .cancel,handler: { _ in
}))
}
func configureRefreshControl() {
moviesTableView.refreshControl = UIRefreshControl()
moviesTableView.refreshControl?.addTarget(self,action: #selector(handleRefreshControl),for: .valueChanged)
}
@objc func handleRefreshControl() {
self.moviesTableView.reloadData()
dispatchQueue.main.async {
self.moviesTableView.refreshControl?.endRefreshing()
}
}
@IBAction func setorder(_ sender: UIBarButtonItem) {
present(actionSheet,animated: true,completion: nil)
}
}
我能知道为什么会发生吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)