【问题标题】:UITableView cell selected not loading another View选择的 UITableView 单元格未加载另一个视图
【发布时间】:2010-12-21 00:29:23
【问题描述】:

大家好,我遇到了一个奇怪的问题。我试图让我的表格推送另一个视图,称为“productviewcontroller”。

我在标题上同时导入“productviewcontroller”和“myappviewcontroller”。

#import "SearchViewController.h"
#import "MyAppViewController.h"
#import "TBXML.h"
#import "ProductViewController.h"

我正在设置我的桌子来推送另一个视图。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    ProductViewController *productViewController = [[ProductViewController alloc] initWithNibName:@"ProductViewController" bundle:[NSBundle mainBundle]];

    [self.navigationController pushViewController:productViewController animated:YES];
    [productViewController release];

    NSLog(@"Test.");
}

当我选择单元格时,它会给我消息“测试”。但不要推另一种观点。 我在应用委托上设置了 navigationController。

我做错了什么?

谢谢!

【问题讨论】:

    标签: cocoa-touch ios uitableview uinavigationcontroller


    【解决方案1】:

    看起来不错。 ProductView nib 是否包含导航控制器?

    【讨论】:

    • 是的。但我不知道它是否正确。我应该在标题上声明它吗? UINavigationController *navBarController; ?谢谢!
    • 只要你的 .xib 中有一个导航控制器和一个导航项,它就可以独立工作。
    • 是的,它就在那里。我忘了说我设置了一个 TabBar。所以,它是一个 TabBar,它有表格的视图。
    • 嘿,我发现了问题,这就是你所说的。谢谢!!
    【解决方案2】:

    在此视图中使用您的导航控制器,您希望从中推送“ProductControllerView”并将其与 IBOutlet 绑定,然后您就可以推送视图了..

    【讨论】:

    • 无需在应用委托中添加导航控制器
    • 是的,但问题是在这个视图中我已经有一个 UITableView。如何在 TableView 中设置导航控制器?
    猜你喜欢
    • 1970-01-01
    • 2012-10-18
    • 1970-01-01
    • 1970-01-01
    • 2011-07-27
    • 1970-01-01
    • 2015-04-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多