I am using PKRevealController to display a left side controller.
The PKReveal is connected to my main view controller which is a navigation controller.
I would like when pressing an option from the left side menu it will push a view controller (which is connected to the main view using segue - I use Storyboard).
I'm trying to make it happen from the left side VC - I use the PushViewController but nothing happens.
I am pretty sure you've already overcome this issue, anyway:
Test the class of your RevealController.frontViewController. If it's a navigationController just call [revealController.frontViewController pushViewController: animated:]
Your reveal controller should be accessible from the leftViewController.
If you use storyboard, just instantiate the viewController you want to push by calling [self.storyboard instantiateViewControllerWithIdentifier: ] then push it from the revealController.frontViewController.
This should work. Don't know if this is what you're looking for. Hope this help.
Related
I have a problem with the tab bar for my app. When I open my app the bottom tab appears since I am using the Tab bar controller however when I move to another view controller and come back the tab bar is gone. Do I have to do something to the storyboard?
Ok, as I suspected, you're going "back" in an incorrect way. You should never go backwards to a previous controller with a segue unless you use an unwind segue. What you're doing is instantiating a new instance of that controller you think you're going back to -- one that isn't embedded in a tab bar controller. So, you either need to use an unwind segue, or go back in code using dismissViewController:animated:completion: (assuming that you're using modal segues to go forward).
If you navigate to another view with the following:
NamedViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:#"NamedViewController"];
[self.navigationController pushViewController:svc animated:YES];
and use the following to go back it should work.
[[self.navigationController popViewControllerAnimated:YES] viewWillAppear:YES];
I have the following hierarchy in Storyboard
Tab Bar Controller >> Navigation Controller >> Players View Controller (Table View Controller) >> Player Details View Controller.
All navigation is done in storyboards using relationships / segues. Delegates are used for backward navigation.
I want to open Players detail view controller when a push notification is received. Also if any other view controllers are in top of hierarchy, I want to remove all views before showing players detail view controller.
Is it possible to navigate using the above scenario. Any help will be highly appreciated. Reply for any clarifications.
Instead of using the segue from storyboard, we can use the old way to manually push to PlayerDetailsViewController, like this:
PlayerDetailsViewController *playersDetailsViewController = [yourStoryboardInstance instantiateViewControllerWithIdentifier:#"PlayerDetailsViewController"];
[self.navigationController pushViewController:playersDetailsViewController animated:YES];
Whenever the push nitification coming, just call the method above to manually push.
I have one problem for which im not sure how to solve. Currently i have main UIViewController with some buttons. This is the initial view that is created with app. On it, one button calls storyboards segue with style Modal on ViewController which is part of UINavigationController. After that few other viewcontrollers are handled within the UINavigationController via segues and getting back via navigationController:popViewControllerAnimated. What i dont know is how to get back from UINavigationController to first UIViewController. I tried, when I'm on first one on navigationctrl,
[self removeFromParentViewController];
yet that only removes the view but it seems that UINavigationController somehow stays alive as result is black screen. Creating unconnected segue and call it from code would be possibility, but im not sure if that is the proper way. Would that leave navigation controller alive ?
Is there any reason you are using a UIViewController first and THEN a UINavigationController?
Why not change this so that the UINavigationController is the initial view controller and then drive everything from there.
If you want the first view to not have a nav bar then you can hide it easily.
That way you can move around through all views by popping and pushing through the UINavigationController.
I added this code to perform a segue:
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:#"groupselection"];
[self.navigationController pushViewController:controller animated:YES];
I then gave the viewcontroller in the storyboard this id: groupselection
But the segue is not performed!! Any ideas?
yes, you do not push view controllers in storyboards so don't use PushViewController.
You use
[self performSegueWithIdentifier:#"Identifier you gave your segue"];
then you wire up the segue inside the storyboard by control dragging. Make sure you drag from the existing controller (the yellow circle below the controller with square inside it) to the new one, and then selecting what kind of segue you want (push, modal, replace)
then you will see a wire connecting the two controllers. Click on the middle circle, when the story is zoomed in all the way. In identity inspector on the right, give this seugue an identifier. That's the name you will use in your code.
Technically, this is not a segue, but rather just pushing a new controller onto your navigation stack. If you are using storyboards just create a real segue. You will have to post more code for us to trouble-shoot this. When are you pushing this view controller? Is your storyboard view controller with that ID subclassed?
I got an application with a tabbar and a navigation controller for one of the tab view.
The Navigation controller is pushing several views and one of them has a button which permits to add a subview (I am actually displaying a popup message -not an uialert- when pushing that button).
The problem is that I would like now to be able to push a new view controller once I pushed a button in the subview...
I cannot find my navcontroller, even when I use the pushmethod of appdelegate.tabbar.navigationController
Does one of you have easy idea about how to implement that ?
Thanks a lot !
If the button's press action of the second button is being handled in the same UIViewController as the other button's action you should simply be able to use
[self.navigationController pushViewController:newViewController animated:YES];.
If your subview has it's own UIViewController you could add a reference to your first UIViewController or to the navigationController itself and use it that way.