LoginSignup
4
2

More than 5 years have passed since last update.

UIPopoverPresentationControllerの画面回転対応メモ

Posted at

いろいろ調べて解決したのに、忘れてしまって調べなおしたので自分向けメモ。

ユニバーサルアプリを作成していて必ず打ち当たるであろう、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
    }

以上

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2