This problem happens with SDK 8.1, when running under iOS 8.1, but not when running under iOS 7. It is for iPad only. The problem appears both with simulator and on a hardware d
I had the same issue, and deselecting the cell prior to displaying the popover did nothing to resolve my issue. What did work for me was dispatching the popover code to the main queue with a minuscule delay. This produces consistent display of the popover AND allows me to keep the cell SELECTED, which is key to my UI:
Expected UI
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch actions[indexPath.row] {
case .rename:
....
case .duplicate:
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01, execute: {
let copyController = UIStoryboard.init(name: "Actions", bundle: nil).instantiateViewController(withIdentifier: "copyToNavController")
copyController.modalPresentationStyle = .popover
let cell = tableView.cellForRow(at: indexPath)
copyController.popoverPresentationController?.sourceView = cell
if let frame = cell?.frame {
copyController.popoverPresentationController?.sourceRect = frame
}
copyController.popoverPresentationController?.permittedArrowDirections = .left
self.popoverPresenter = copyController.popoverPresentationController
self.present(copyController, animated: true, completion: nil)
})
default:
break
}
}