I have a UIViewController subclass that implement UITableViewDataSource and Delegate. When a user triggers didSelectRowAtIndexPath I alloc init this second ViewController with presentModalViewController and set my class as a delegate. When the user finish working on the modal I notify the parent ViewContoller to save his data and dismiss the modal. At this point I dont have any reference to the UITableView in the parent ViewController.
This code is the header of the Class:
@interface ItemDetailVC : UIViewController <UITableViewDelegate, UITableViewDataSource, ItemAmountViewControllerDelegate> {
IBOutlet UITableView *myTableView;
}
@property (nonatomic, retain) IBOutlet UITableView *myTableView;
@end
So i connected the IBOutlet to the table i draged into my view and set up my class for the dataSource and Delegate for that table.
Here is the call back that will be called after the modal closes up:
- (void) modalCanceled:(sonViewContrller *) sonViewContrller{
NSLog(@"myTableView = %@",myTableView);
[self dismissModalViewControllerAnimated:YES];
}
Please help me understand what I did wrong. Maybe I should have declared the UITableView in code, but I already did it by XIB file and the layout is all set up and I wana keep it that way and make it work.
My direction is that i lost the pointer to the myTableView at some point. So how would one declare that iVar is there a better way to do it?