UITableViewControllerをポップオーバーとして表示しているときに問題が発生しています。ポップオーバーが表示されますが、その幅はフルスクリーンではなく、先頭と末尾に何らかのマージンがあります。詳細はスクリーンショットをチェックしてください:ポップオーバープレゼンテーションコントローラ - 表示に前後にスペースがあり、全幅に収まらない
は、これは私がセットアップし、現在のコントローラに使用していたコードではありません:
let controller = UITableViewController()
controller.preferredContentSize = CGSize(width: self.view.bounds.width, height: self.popOverPresentationControllerHeight)
controller.modalPresentationStyle = .popover
controller.tableView.separatorStyle = .none
controller.tableView.allowsMultipleSelection = true
controller.tableView.dataSource = self.filterOptionsDataSource
controller.tableView.delegate = self
controller.tableView.isScrollEnabled = false
controller.tableView.register(FilterOptionCell.self, forCellReuseIdentifier: FilterOptionCell.identifier)
controller.tableView.register(UINib(nibName: FilterOptionCell.identifier, bundle: nil), forCellReuseIdentifier: FilterOptionCell.identifier)
controller.tableView.register(FilterConfirmCell.self, forCellReuseIdentifier: FilterConfirmCell.identifier)
controller.tableView.register(UINib(nibName: FilterConfirmCell.identifier, bundle: nil), forCellReuseIdentifier: FilterConfirmCell.identifier)
controller.popoverPresentationController?.popoverLayoutMargins = UIEdgeInsetsMake(0, 0, 0, 0)
controller.popoverPresentationController?.delegate = self
self.present(controller, animated: true, completion: {
UIView.animate(withDuration: 0.25) {
controller.view.superview?.layer.cornerRadius = 4
self.view.alpha = 0.4
}
})
controller.popoverPresentationController?.backgroundColor = UIColor.white
controller.popoverPresentationController?.sourceView = sender
controller.popoverPresentationController?.sourceRect = sender.bounds
も実装されてadaptivePresentationStyle
機能が、それでも、何の違い:
追加質問
上矢印を変更/変更する方法はありますか?この矢印は私の使用には大きすぎるようですので、それを小さくしたり、カスタムのものに置き換える方法はありますか?
EDIT
一部を調査し、controller.view.superview?.frame
をプリントアウトした後、私は、その幅は、それがポップアップの両側にそのスペースを説明しているべきであるよりも20ポイント小さくなって気づきました。しかし、それを取り除く方法は何ですか?