Pulley icon indicating copy to clipboard operation
Pulley copied to clipboard

adding a button or uiview to the top of the drawer

Open AdieOlami opened this issue 6 years ago • 7 comments

is it possible to append a button to the top of the drawer? eg in a map view where I can center the location, if I have the drawer opened, how can I make sure the button would be append tot he top of the top of the drawer

or like the powered by Google image which must always be visible on the google maps but the drawer covers it. How do I make the powered by Google show just above the drawer and when the drawer is closed, the mage goes to the base where it was initially

AdieOlami avatar Feb 20 '19 13:02 AdieOlami

Checkout the sample project. It does this with a view. Let me know if you have any questions.

amyleecodes avatar Feb 20 '19 16:02 amyleecodes

I implemented it but the map Button does not work and I tried it with my own code too it does not work. I do not display the bottomDrawer when viewLoads. The buttom drawer is subjected to me pressing a button


func drawerChangedDistanceFromBottom(drawer: PulleyViewController, distance: CGFloat,
                                         bottomSafeArea: CGFloat) {
        
//        guard drawer.currentDisplayMode == .drawer else {
//
//            fabBottomConstraint.constant = fabBottomConstraintDistance
//            return
//        }
//
//        if distance <= 268.0 + bottomSafeArea
//        {
//            fabBottomConstraint.constant = distance + fabBottomConstraintDistance
//        }
//        else
//        {
//            fabBottomConstraint.constant = 268.0 + fabBottomConstraintDistance
//        }

            guard let drawer = drawer as? BottomSheetVC else { return }
            
                let distance = distance - bottomSafeArea
                if drawer.mode == .estimate || drawer.mode == .onTrip {
                    mapView.padding = UIEdgeInsets(top: 20, left: 0, bottom: 20, right: 0)
                } else {
                    mapView.padding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
                }
                fabBottomConstraint.constant = distance + 16
    }

AdieOlami avatar Feb 21 '19 09:02 AdieOlami

Drawer is an instance of PulleyViewController, not BottomSheetVC. Your guard statement may be returning early. I’d recommend stepping through the code with the debugger and making sure it’s all running.

Note: Subclassing or altering Pulley is not a recommended or supported case. It should be used as-is.

amyleecodes avatar Feb 21 '19 15:02 amyleecodes

In the code they also use 268 without an explanation. Do you mind telling me why 268, because as it is its a magic number

NjeriNjoroge avatar Feb 25 '19 13:02 NjeriNjoroge

268 where @NjeriNjoroge ??

AdieOlami avatar Feb 25 '19 15:02 AdieOlami

268 is what is being used as the partially revealed drawer stop height.

amyleecodes avatar Feb 25 '19 16:02 amyleecodes

In the PrimaryContentViewController

NjeriNjoroge avatar Feb 26 '19 06:02 NjeriNjoroge