How do we assign object into UINavigationController without pushing a ViewController object into it.
Why do I need it is here :
I have total three Segment views and one of the segment is this that I am adding as subView :
-(void)Frds{
[self clearSubView];
obj = [[Frds alloc]initWithNibName:@"Frds" bundle:nil];
[obj.view setFrame:CGRectMake(0, 65, 320, 568)];
[self.view addSubview:obj.view];
}
and from Frds class when I access self.navigationController. It returns me nil, and it should obviously since I have not pushed the ViewController into it.
So, What is the way to access navigationController in Frds class after adding 'Frds' class object view as a 'subview' from forwarding class.
You can add your frnd View object on rootviewController view object . First assign one rootviewcontroller on your navigation controller then you can easily add your view on it .
For assigning root view controller on navigation controller :
UINavigationController *navigationController=[[UINavigationController alloc] initWithRootViewController:detailViewController];
Use this method to find your root view controller:
UIViewController *rootViewController = self.navigationController.viewControllers[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With