You can do this by two means.
The first you just set a property in the next UIViewController
the type of object you want to display the information on. Once this is done, you urge UIViewController
that 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 medium, which is via delegate navigation methods. Just use the function performSegueWithIdentifier:
and also define a property in the UIViewController
who wishes to submit the information.
Example:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier: @"Detalhes" sender: self];
}
In the delegate method of navigation you urge to UIViewController
whether to define 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];
}
}
I will try and return with the result! Thank you!!
– Tiago Amaral
Good your code helped me! But I did the navigation using Static Cell. Then the cell behaves like a button through the storyboard and it is possible to use the navigation by push or model transiction. But thank you!!!
– Tiago Amaral