TabBar
Basically when we are taking Tab Bar as the source of view controller and suppose four view controller are attached with tab bar respectively. in most of the time when we are taking navigation controller in the wrong manner then tab bar never show, due to that we have to make tab bar as root and all view controller as the child and it will directly connect to the respective view controller .
1: Take tab bar as root view controller.
2: Suppose four view controller are connected to that tab bar then it will connect through navigation controller.
TabBar —>NavigationController –> ViewContrller1 –> ViewController2 –>nextViewController.
3: When are taking any new navigation controller in between any view controller then it will create the separate stack to maintain a view controller to navigate due to that reason tab bar loose their parent view and it becomes unavailable for that view controller .
4: In every view controller we shall have to take navigation item only ( for default creating “< Back” button to navigate).
5: Connect view controller using segue call like that .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"categorySegue"]) { ProductCategory *destViewController = segue.destinationViewController; destViewController.categoryId = categoryDict[@"category_id"]; destViewController.categoryName = categoryDict[@"name"]; } else if ([segue.identifier isEqualToString:@"subCategorySegue"]) { SubCategory *destViewController = segue.destinationViewController; destViewController.subCategoryData = categoryDict; destViewController.categoryName = categoryDict[@"name"]; } } |
6: Now it will show in every view controller.