DidSelectRowAtIndexPath永远不会被调用

时间:2014-06-10 14:54:03

标签: ios objective-c didselectrowatindexpath uitableview

我从今天早上起就遇到了一个问题,我发现自己没有找到解决办法。

这是我的问题:

我有一个包含UItableView和其他东西的视图控制器......该部分没问题:我的tableView调用我的webService,并重新加载填充的tableView。但是当我想在UItableViewCell的选择上触发执行segue时没有任何反应。

我的tableView DataSource和Delegate已设置:

ViewController referencing outlet ObservatoireView.h

我尝试了几种方法但没有任何作用:

1)直接链接细胞上的segue 2)在viewController上声明segue并用" performSegue"来调用它。当" didSelectRowAtIndexPath"叫做 3)重启Xcode(是的,我绝望了)

但是,正如我之前所说的那样,我的tableView的委托和数据源方法被正确调用,除了" didSelectRowAtIndexPath"

有人已经遇到此问题并找到了解决方案吗?

编辑:

这是tableView dataSource方法的实现

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return campagneList.count; //return 2 at execution
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"observatoireSegue" sender:self];
    NSLog(@"test didSelectRowAtIndexPath");
}

1 个答案:

答案 0 :(得分:0)

您不应该从ObservatoireView类继承ViewController。显然编译器不会抛出任何错误或警告。如果这样做,则不会从类到控制器进行消息通信。因此,如果您将父类更改为UIViewControllerUITableViewController,那么它将起作用。

@interface ObservatoireView :UIViewController <yourprotocols> 

//Rest of code goes here

@end
相关问题