Question

whats the best way, to init a DetailView from a TableView with data?

I need to "send" a object to fill all the labels and ImageViews.

My Code for changing the view:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"detailView"] animated:true];
}

Maik

Was it helpful?

Solution

Just take the ViewController instantiated from the storyboard and set it up before you push the ViewController

YourViewControllerclass * vc = (YourViewControllerclass*) [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
[vc setupMethodForObject: object];
[self.navigationController pushViewController:vc animated:YES];

OTHER TIPS

DetailViewController *viewController = (DetailViewController*) [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
viewController.myProperty1 = object1;
viewController.myProperty2 = object2;
[self.navigationController pushViewController:viewController animated:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top