Closed alpa99 closed 7 years ago
For collapsedDrawerHeight, you'll want to provide a height that's 2x your tabbar. Depending on how you're loading your VC structure, that may or may not be doable with this line of code:
return (self.tabBarController?.tabBar.bounds.height ?? 56.0) * 2.0
If your tabbar controller isn't in the VC hierarchy yet, that'll evaluate to zero and cause issues with Pulley. It'll either not show, be frozen, or both. (because that math isn't made for that). In that case, you'd want to hardcode the number. On current versions of iOS, the height of a tabbar is 56 pts. So, you could just do:
return 112.0
For partialRevealDrawerHeight, return whatever height you want the drawer to be when it's half-way open.
For supported drawer positions, return an array of what positions you want the drawer to consider as 'stop' points. You can see the example project for more information on that one, so you can customize it to your needs.
I´m sorry but it doesn't change anything at all. I tried both ways. It doesn't give me any error or something there is just no change when i do run. I also tried to change the line
private let kPulleyDefaultCollapsedHeight: CGFloat = 68.0
to
private let kPulleyDefaultCollapsedHeight: CGFloat = 120.0
inside the PulleyViewController.swift file but no changes at all.
Here is the full swift file for the DrawerVC
class DrawerContentViewController: UIViewController, PulleyDrawerViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func collapsedDrawerHeight() -> CGFloat {
return 120.0
}
func partialRevealDrawerHeight() -> CGFloat {
return 264.0
}
func supportedDrawerPositions() -> [PulleyPosition]{
return PulleyPosition.all
} }
How are you creating the Pulley VC? It sounds like this drawer VC isn't being setup as the drawer VC for Pulley. If you're using Interface Builder, did you change the class type of the View Controller to your subclass? If not, you'll get the Pulley defaults.
Yes with the Interface Builder. I think its all connected right.
If you don't have much code in your project, do you mind sharing a zip file of it? I'd be happy to take a look for any config issues that may be present. If you'd like to send it over email, rather than posting on the issue publicly, then you can email me: brendan@52inc.com
I have sent u an email with the zip its about 23 mb hope u received it.
What you had wrong was that you manually added the Pulley files to your project and had included it with CocoaPods. You were using the Pulley drawer from the CocoaPod in Interface Builder, so it was looking for the delegate provided by the CocoaPod framework. Because you had the files in your main project too, Swift found the delegate implementation there (rather than in the pod). Swift namespaces things, so the delegate from the files you manually imported is technically different than the delegate in the CocoaPod version (even though they’re named the same). Because you didn’t import Pulley into the file, it used the version that was in your main project (incorrectly) rather than the one in the framework. This meant that it wasn’t calling your delegate methods, and you were getting the default values.
You should only import it 1 way, Cocoapods or manually. We recommend CocoaPods.
Oh okay. I deleted the files i imported manually and added 'import Pulley' to the top now it works. Thanks a lot !
Hi, sorry for these easy questions but im a bloody beginner :) I want to customize the collapsed height of the drawer. So far i implemented the PulleyDrawerViewControllerDelegate protocol in the DrawerContentVC and added inside the class the three functions
func collapsedDrawerHeight() -> CGFloat {
}
what do i have to type inside these functions to set the collapsed Drawer Height twice as big as the height of my Tabbar ?
Thanks in advance :)