开发者

Pushing new view controller from UITableView on a Tab Bar application

I have an app with two bar in it. one of the tab .xib includes UITableView, when the user select one of the cells, I want to show another UIViewcontroller (.xib file) that includes information about the his selection.

now, I've tried this

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath { 
NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:开发者_C百科nil];   
[self.navigationController pushViewController:nextController animated:YES];     [nextController changeProductText:[arryData objectAtIndex:indexPath.row]]; 
}

and nothing happened, the console is showing no errors at all.

what seems to be the problem?

thanks!


Nothing happened, because your self.navigationController returns nil. For proper usage of Navigation controller, you must have at least one. For the case of TabBar application, for each tab you must associate not the UIViewController subclass, but UIViewController subclass nested in UINavigationController. That's easily done both in the .xib or in code. Just google for some tutorials.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜