52inc / Pulley

A library to imitate the iOS 10 Maps UI.
https://cocoapods.org/pods/Pulley
MIT License
2.02k stars 265 forks source link

iPad panel mode - the map area is not touchable when adding Pulley programmatically #361

Open az-oolloow opened 5 years ago

az-oolloow commented 5 years ago

I tried adding Pulley with Carthage, and while it sort of works, i can't tap the map that i drew behind the drawer.

e.g.

class MyViewController: UIViewController {
    override func viewDidLoad() {
                let drawer: UIViewController = UIViewController()
        drawer.view.backgroundColor = .red

        let main = UIViewController()
        let mv = MKMapView()
        mv.translatesAutoresizingMaskIntoConstraints = false
        main.view.addSubview(mv)
        mv.leftAnchor.constraint(equalTo: main.view.leftAnchor).isActive = true
        mv.rightAnchor.constraint(equalTo: main.view.rightAnchor).isActive = true
        mv.topAnchor.constraint(equalTo: main.view.topAnchor).isActive = true
        mv.bottomAnchor.constraint(equalTo: main.view.bottomAnchor).isActive = true

        let pulley = PulleyViewController(contentViewController: main, drawerViewController: drawer)
        pulley.allowsUserDrawerPositionChange = false
        pulley.displayMode = .automatic
        pulley.panelCornerPlacement = .topRight

        pulley.view.translatesAutoresizingMaskIntoConstraints = false
        self.view.addSubview(pulley.view)
        pulley.view.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
        pulley.view.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
        pulley.view.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
        pulley.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
    }
}

The area below my red drawer can't be interacted with, e.g. if i double tap it then the mapview doesn't zoom in. It seems that the PulleyPassthroughScrollView doesn't pass the hits down somehow.

It works fine in demo app, but that uses Storyboards.

Any ideas on what i did wrong?