开发者

Accessing UITableViewController > UIView > UIView?

开发者 https://www.devze.com 2023-01-16 05:17 出处:网络
Can anyone tell me if this is possible? I have a setup a UITableViewController which consists of a number of cells, if you select one of these cells you are taken to a new viewController using pushVi

Can anyone tell me if this is possible?

I have a setup a UITableViewController which consists of a number of cells, if you select one of these cells you are taken to a new viewController using pushViewController (see below)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)inde开发者_开发知识库xPath {
    NSUInteger row = [indexPath row];
    NSLog(@"CELL__: You tapped the row ... %@", [list objectAtIndex:row]);
    TestController *testController = [[TestController alloc] init];
    [[self navigationController] pushViewController:testController animated:YES];
    [testController release];
}

If in the implementation for "TestController" I would like to refer back to [self navigationController] (or maybe to add yet another view) is there any way to do that. My problem is that I need to access [self navigationController] to push further views and I don't know how to do that from the bottom controller?

Does that make sense?

Gary


From within TestController you reference the same UINavigationController via [self navigationController] as well.

EDIT to elaborate after comment:

The navigationController property is a property of UIViewController. If the controller is contained within a UINavigationController then it's own navigationController property will be a reference to that container UINavigationController. The same applies for tabBarController and splitViewController.

0

精彩评论

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

关注公众号