Using definesPresentationContext with UIModalPresentationStyle.custom

后端 未结 1 1383
名媛妹妹
名媛妹妹 2021-02-08 12:23

I am using view controller containment to manage a set of child view controllers which should be able to modally present other view controllers in a custom manner.

相关标签:
1条回答
  • 2021-02-08 13:06

    In your UIPresentationController subclass, override shouldPresentInFullscreen as follows:

     override var shouldPresentInFullscreen: Bool {
         get {
             return false
         }
     }
    

    As per the UIPresentationController header:

    // By default each new presentation is full screen.
    // This behavior can be overriden with the following method to force a current context presentation.
    // (Default: YES)
    @property(nonatomic, readonly) BOOL shouldPresentInFullscreen;
    

    This along with definesPresentationContext should do the trick.

    0 讨论(0)
提交回复
热议问题