I'm having trouble implementing the protocol and delegate relationship described in this post: Passing Data between View Controllers
Under the "Passing Data Back" section, # 6 says:
The last thing we need to do is tell ViewControllerB that ViewControllerA is its delegate before we push ViewControllerB on to nav stack.
ViewControllerB *viewControllerB = [[ViewControllerB alloc] initWithNib:@"ViewControllerB" bundle:nil];
viewControllerB.delegate = self;
[[self navigationController] pushViewController:viewControllerB animated:YES];
Can you help me describe where this last portion of code goes? I have tried and tried, and read the entire post many times and can't seem to figure this out without getting several errors. Thanks for your help.
Update: I placed the code in viewDidLoad method in my ViewControllerB (child) equivalent, and received these errors::
- No visible @interface for 'ViewControllerB' declares the selector 'initWithNib:bundle:'
- Indexing expression is invalid because subscript type 'void' is not an integral or Objective-C pointer type