Pushing data from a UITableViewCell to a UINavigationController

情到浓时终转凉″ 提交于 2019-12-02 22:45:17

问题


I have a UISearchDisplaycontroller that i have to push information to text fields and need to link it to a navigation view controller.

Here is my code -

- (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:


Your UINavigationController heirarchy is wrong or it is wrongly placed.

Plz refer

http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html



来源:https://stackoverflow.com/questions/27393433/pushing-data-from-a-uitableviewcell-to-a-uinavigationcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!