I have a list of items inside a TableView I would like when clicking on an item in the list a new ViewController is opened containing the information referentere to the selected item I'm not able to make the view open using the method below:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Muro selecionado
NSInteger linha= indexPath.row;
Muro *c =[Muros objectAtIndex:linha];
//navega para a tela detalhes
DetalhesMuroViewController *detalhes = [[DetalhesMuroViewController alloc] init];
detalhes.muro = c;
[self.navigationController pushViewController:detalhes animated:YES];
What am I doing wrong?
In this link are all project files GaleRio .
I tried to use the second option and it returns me the following compilation error
No visible @interface for "DetailsMuroViewController" declares the "setItem" selector
The code looks more or less like this
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
DetalhesMuroViewController * detailViewController = [storyboard instantiateViewControllerWithIdentifier:@"Detalhes"];
[detailViewController setItem:[Muros objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:detailViewController animated:YES];
}