Closed alpa99 closed 7 years ago
I have one more question I d like to ask here. My PrimaryContentVC contains a map and this map contains annotations. When the annotation view opens there is a detail button. I want by pressing this button to open the drawer vc in a partially revealed position. What do I have to write where ? Haha Im sorry for this kind of question but its my first ever project :)
Apologies that I was just now able to get to this.
That's expected. When you embed your Drawer Content VC in a navigation controller, and then assign the navigation controller as the drawer content in Pulley, the navigation controller is the drawer content VC from Pulley's point of view. You'll need to implement the delegate methods in a custom subclass of UINavigationController. You can write your subclass to forward these to the currently visible view controller in the navigation stack if you'd like, but that's an implementation detail left up to you.
As you've seen a navigation push from inside the drawer will cause the new view controller to remain in the drawer. This is how navigation controllers work, which is expected. Any form of Modal presentation will hide the tabbar, so I'm assuming you want to do a navigation push. In that case, you want your view controller structure to look like this: Window.rootViewController -> UITabbarController -> UINavigationController -> Pulley -> Drawer / main content. This makes it so that when you 'push' to a new view controller, Pulley disappears. This will allow your tabbar to remain on top.
And for your last question:
You want to call 'setDrawerPosition' on the Pulley VC when you want to do this. If your view controllers have a reference to Pulley, you can invoke it on that. If you don't have a reference, you can obtain a reference to Pulley from within your drawer view controller or main content view controller (assuming they're directly in Pulley, no navigation / etc in the middle) by doing this: (parent as? PulleyViewController).setDrawerPosition(...)
.
Thanks for your help. It all worked out.
But I did explain the second problem wrongly sorry. I changed the view controller structure just like you said and the BarDetailVC appears just like I told you I want to. But is it possible to make the BarDetailVC to still remain inside the drawer but the next upcoming view to be not inside the drawer ? Do I have to use the setDrawerContentViewController Method inside a prepare for segue func ? How do I have to use it if ?
You can put a navigation controller as the drawer content VC, if you want, and do it that way. But, you'll need to find a way to route pushes back to the navigation controller containing Pulley VC for when you don't want to show it in the drawer.
You can also use setDrawerContentViewController, which would be easier. If you want to use this method, you'll need to manually create your view controller instance and then pass it to that method.
You can also use setDrawerContentViewController, which would be easier. If you want to use this method, you'll need to manually create your view controller instance and then pass it to that method.<
yes I think thats the best option hence BarDetailVC is the only additional VC i want to present inside the drawer. But do I have to write it inside the DrawerContentVC class or the BarDetailVC class ? If its inside DrawerContentVC do I have to put it inside a prepare for segue class that it doesn't get called to early ?
Your drawer content vc would call it, and pass it the bar detail VC instance. If you need to go 'back', you'd do the opposite.
You can't do it as a segue, so you'll need to do this in code.
I have inserted these lines inside the DrawerContentVC class but didn't change anything at all.
You don't want to implement that method, instead you want to call it on the Pulley vc.
So, wherever you want this to happen (didSelectRow, or a button press action, etc.) try this (assuming your drawer content VC isn't in a navigation controller):
let detailVC = BarDetailVC()
(parent as? PulleyViewController)?.setDrawerContentViewController(detailVC, animated: true)
Note: If your view controller is loaded from a Storyboard or xib file, make sure you instantiate it the correct way...if that's the case, just loading it with the default initializer like that probably won't work.
Note: If your view controller is loaded from a Storyboard or xib file, make sure you instantiate it the correct way...if that's the case, just loading it with the default initializer like that probably won't work.
yes i had to instantiate it. :) But now the BarDetailVC doesn't have the navigation bar at top... That means no Back button in the top left corner... what am i doing wrong ?
I made the Navigationbar hidden for the DrawerContentVC but for the BarDetailVC i called self.navigationController?.setNavigationBarHidden(false, animated: true) inside the viewWillAppear function
That only shows if your view controller is pushed in a navigation controller. Since you're directly setting the drawer content VC of Pulley (not pushing it in a navigation controller) you won't have a back button provided for you. You'll need to work with a navigation controller as your drawer view controller and push within that, or add your own back button in your Detail VC.
Ok i got it thanks for all the help. I think adding just an own back button should be enough here :)
Thanks !
Im sorry but I had to reopen this because I tried to add my own back button doing it like i did before but when i test it the app crashes. Shouldn't it work backwards the same way ?
It should work the same. What error do you get when it crashes?
Well its a really long text inside the console... I think these lines might be helpful
ERROR!! 2017-08-22 00:11:53.708 testapp[66270:2482664] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[AVCaptureMetadataOutput setMetadataObjectTypes:] Unsupported type found - use -availableMetadataObjectTypes' *** First throw call stack:
But the AVCaptureMetadataOutput method has nothing to do with these VCs its part of the QRScanner from the other tab. I don't know why this is written there
It sounds like your Storyboard instantiation line is instantiating your QRScanner, somehow / somewhere.
Well i deleted everything and just repeated and now it works thank you anyway 👍
You are doing great work
I appreciate it a lot !
Thanks! Glad it worked!
Hello, in the picture below you can see how I build up the drawer content in the storyboard. What you can't see is that the pulleyVC is also embed in a tabbarcontroller.
I have now 2 problems with the results of this, I don't know how to fix.