Can you contact the sender of the message without passing the sender as a parameter? This is the simplified code to discuss:
[dataModel loadData];
-(void) loadData{
sendingTableViewController = ???? ;
}
- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
[sendingTableViewController.tableView reloadData];
}
I'm still used to how to access methods and properties that are responsible for another object. I want to send a message dataModelto download some data using NSURLConnection. But I do not want the data returned , because I do not want to sit waiting for the data to load. I want to send a message to mainTableViewControllerwhen called connectionDidFinishLoading.
Since the method loadDatacan be called from any number tableViewControllers, I can’t just say [mainTableViewController reloadData].
Subsequent question
Excellent information! I love the carefree nature of StackOverflow.
, mainTableViewController dataModel?
, dataModel ?
dataModel mainTableViewController. :
dataModel *myDataModel = [[dataModel alloc] initWithDelegate:self ];
-(void) dataDidFinishLoading {
[self.tableView reloadData];
}
-(id) initWithDelegate:(id)aDelegate{
self.delegate = aDelegate;
}
-(void) connectionDidFinishLoading:(NSURLConnection *)connection {
[self.delegate dataDidFinishLoading];
}
, TableViewController myModel, dataModel TableViewController? dataModel AppDelegate ?
!