いろいろ調べて解決したのに、忘れてしまって調べなおしたので自分向けメモ。
ユニバーサルアプリを作成していて必ず打ち当たるであろう、iPadのポップオーバーを画面回転に対応させる(吹き立ちのくちばし部分を回転にあわせて変更する)方法のメモ。
swift2の場合はmemory。swift3からpointeeに変わったので注意。
///
/// UIPopoverPresentationControllerDelegate
///
/// 画面の回転対応
///
func popoverPresentationController(_ popoverPresentationController: UIPopoverPresentationController, willRepositionPopoverTo rect: UnsafeMutablePointer<CGRect>, in view: AutoreleasingUnsafeMutablePointer<UIView>) {
let baseView = 起点としたいView
view.pointee = baseView
rect.pointee = baseView.bounds
popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirection.unknown
}
以上