如何解决得到“ [LayoutConstraints]无法同时满足约束”在ActionSheet中
我设置了带有操作表的表格视图。但是每当介绍操作表时我都会遇到问题。
这是代码和图像的一部分。
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 举报,一经查实,本站将立刻删除。