Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Prevent fullscreen #19

Open
UtkuDalmaz opened this issue Oct 4, 2018 · 1 comment
Open

Prevent fullscreen #19

UtkuDalmaz opened this issue Oct 4, 2018 · 1 comment

Comments

@UtkuDalmaz
Copy link

Hi there

How can I prevent modal viewcontroller to be fullscreen?

@podratz
Copy link

podratz commented Dec 23, 2018

You can achieve this by cancelling the pan when the drag offset becomes negative.

class HalfModalPresentationController: UIPresentationController {
   
    // ...
    
    func onPan(pan: UIPanGestureRecognizer) -> Void {
        let endPoint = pan.translation(in: pan.view?.superview)
        
        guard endPoint.y > 0 else {
            return pan.state = .cancelled
        }
        
        // ...
   
    }

    // ...

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants