Pulley
Pulley copied to clipboard
adding a button or uiview to the top of the drawer
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
Checkout the sample project. It does this with a view. Let me know if you have any questions.
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
}
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.
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
268 where @NjeriNjoroge ??
268 is what is being used as the partially revealed drawer stop height.
In the PrimaryContentViewController