将数据从UITableViewCell推送到UINavigationController

时间:2014-12-10 04:37:39

标签: ios xcode hyperlink push

我有一个UISearchDisplaycontroller,我必须将信息推送到文本字段,并需要将其链接到导航视图控制器。

这是我的代码 -

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showRecipeDetail"]) {
    NSIndexPath *indexPath = nil;
    Recipe *recipe = nil;

    if (self.searchDisplayController.active) {
        indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
        recipe = [searchResults objectAtIndex:indexPath.row];
    } else {
        indexPath = [self.tableView indexPathForSelectedRow];
        recipe = [recipes objectAtIndex:indexPath.row];
    }

    RecipeDetailViewController *destViewController = segue.destinationViewController;
    destViewController.recipe = recipe;



}

}

1 个答案:

答案 0 :(得分:0)