I have one page(say X) before tab bar controller that use model segue to open tab bar controller. Also first screen of tab bar controller is same with X.
I want to pass data from X to tab bar controller's first page.
Shortly, I want to pass data from view controller to tab bar controller page with storyboard segue. Is there any method for this ?
Here is the solution ;
locationsHome* vc = [[locationsHome alloc] init];
UITabBarController* tbc = [segue destinationViewController];
vc = (locationsHome *)[[tbc customizableViewControllers] objectAtIndex:0];
This is how I solved my problem. You can pass data from ViewController to TabBarController with this method.
Use this code within prepareForSegue
method
locationsHome* vc = [[locationsHome alloc] init];
UITabBarController* tbc = [segue destinationViewController];
vc = (locationsHome *)[[tbc customizableViewControllers] objectAtIndex:0];
Like this:
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
NSString * segueIdentifier = [segue identifier];
if([segueIdentifier isEqualToString:@"tabbarGo"]){
locationsHome* vc = [[locationsHome alloc] init];
UITabBarController* tbc = [segue destinationViewController];
vc = (locationsHome *)[[tbc customizableViewControllers] objectAtIndex:0];
etc...
}
}
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