The ViewController which has 2 buttons can be made as rootViewController to the NavigationController. The NavigationController can be added to the window.
Window -> NavigationController -> UIViewController (as rootView)
Hope this helps.
문제
Currently I have a UIViewController
with a couple of buttons that when pressed move to a UITableViewController
. Each button loads a specific array of data to the UITableViewController
by identifying the segue of the specific button and displaying the corresponding data.
This works fine as is.
However I wish to add an embedded UINavigationController
so I can navigate through the UITableViewController
and and corresponding views while still being able to 'press back' to the initial UIViewController
.
Firstly, where am I meant to put this. I tried over the tableViewController and 2 things happen -
a) If the segues still go to the UITableViewController
, there is no navigation displayed.
b) If I move the segues to go to the UINavigationController
, none of my arrays show in the tableViewController, but I do have navigation.
Where do I link my segues or where do I embed the UINavigationController
so this works?
(I haven't put any code as I don't think this will involve it, but if it does just let me know and I will add).
Not sure if I'm missing something but, it's not working. I want to be able to still utilize the buttons I already have and not use the buttons on the navigation from the UIViewController to the UITableViewController.
For Hiding the Navigation on root
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
}
해결책
The ViewController which has 2 buttons can be made as rootViewController to the NavigationController. The NavigationController can be added to the window.
Window -> NavigationController -> UIViewController (as rootView)
Hope this helps.
다른 팁
Select the root view controller->editor->embed in->navigation controller