You can do this by two means.
The first thing you need to do is set a property in the next UIViewController
of the type of object you want to display the information. When you do this, you instantiate the UIViewController
you want to show the information.
For example:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
DetalhesEAlteracoesViewController *detalhesViewController = [storyboard instantiateViewControllerWithIdentifier:@"Detalhes"];
[detalhesViewController setObjeto: objetoASerDescrito];
[self.navigationController pushViewController:detalhesViewController animated:YES];
}
The second you can use another means, which is through the delegate navigation methods. Just use the performSegueWithIdentifier:
function and also set a property on UIViewController
you want to display the information.
Example:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier: @"Detalhes" sender: self];
}
In the delegate navigation method you instantiate UIViewController
if you set the object:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString: @"Detalhes"]) {
DetalhesEAlteracoesViewController *detalhesViewController = [segue destinationViewController];
[detalhesViewController setObjeto: objetoASerDescrito];
[self.navigationController pushViewController: detalhesViewController animated:YES];
}
}