My parent ViewController class contains a UISearchBar. I have a UIButton that will push on a new ViewController via the code below
AddViewController *addViewController = [[AddViewController alloc] initWithNibName:@"AddView" bundle:nil];
[self presentModalViewController:addViewController animated:YES];
[addViewController release];
In the AddViewController the User is presented with a TableView of animal names. On the
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
I extract the the animal name and store it in an NSString. I then dismiss the AddViewController by
[self dismissModalViewControllerAnimated:YES];
My Question is How do I pass the NSString animal name to the Parent ViewController of AddViewController? I’m attempting to place the animal name in the UISearchBar
You would need to create a Delegate.
http://iosdevelopertips.com/objective-c/the-basics-of-protocols-and-delegates.html
These allow you to communicate with the parent view controller, and in your case, pass a variable.