Вопрос

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

Это было полезно?

Решение

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];

Другие советы

DetailViewController *viewController = (DetailViewController*) [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
viewController.myProperty1 = object1;
viewController.myProperty2 = object2;
[self.navigationController pushViewController:viewController animated:YES];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top