I’ve managed to read some values into a table view and display them in the Master View of a SplitViewController.
What I would like to do is to tap on a row of the Master View and display the details on the detailViewController but in a custom cell of a TableView which has a label and a textfield.
When I tap on the row in the MasterView table, I can’t seem to get the detail to populate the detailview custom cell.
I tried something like
if (indexPath.row == 0) {
lbPerson.text = @"Name";
tfPerson.text = @"John";
tfPaciente.placeholder = @"Name";
}else if (indexPath.row == 1) {
lbPerson.text = @"Address";
tfPerson.text = @"Street blabla";
tfPerson.placeholder = @"Address";
}
but I am not sure where to place my code and how to update my detailview tableview when I tap my masterview table
Thank you!
In your detailView you should have “id detailItem”, this is then set in the delegate method :
-(void)setDetailItem:(id)newDetailItem {
}
-(void)configureView {
}
To call this method in your MasterView implement something like this:
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
This will call the first method that set the detail view, obviously through this detail item you can set properties of the detailView.