Navigate and pass the string to another VC embedded in a TabVC and NavigationVC

47 Views Asked by At

I have the following Storyboard. Pic

I wish to pass a string say sURL to Classes VC. Classes VC is embedded in a Tab View Controller and a Navigation Controller. Your help is gladly appreciated.

1

There are 1 best solutions below

1
Hanz Cheah On BEST ANSWER

Store what ever string that you want to pass into NSDefaults and then at the other VC call the NSDefaults again.

//=== Strore into session and send over to Classes VC
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:sURLToClass forKey:@"txtURLFromSearch"];
[defaults synchronize];

//=== This is to call Classes VC
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UITabBarController *tabView = [storyboard instantiateViewControllerWithIdentifier:@"profileView"];
tabView.selectedIndex=0; //=== This is to choose which Tab, starts with 0,1,2,3,4
[self presentViewController:tabView animated:YES completion:nil];