0

Using XCode 4.5.2 I have created a Master/Detail iOS 6.0 project from template. The generated project already contains disclosure indicator ">" in table cell and detail view opens when table row is tapped. Then:

  1. I added the Search Bar and Search Display Controller above the master table
  2. According to the following problem I added UITableViewCell class registration in MasterViewController's method - (void)viewDidLoad

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];

After this registerClass line is added I run the program in simulator. The disclosure indicator is not shown in table cells and the detail view does not open when the table row is tapped.

I followed the advice here that adds disclosure indicator back but the detail view still does not open when table row is tapped.

What else is needed?

4

2 回答 2

0

您可以尝试使用dequeueReusableCellWithIdentifier:而不是dequeueReusableCellWithIdentifier:forIndexPath:.
另外,检查是否tableView:didSelectRowAtIndexPath:被调用。

于 2013-02-17T13:48:17.703 回答
0

我找到了甚至可以摆脱的解决方案:

     [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];

- (void)viewDidLoad

解决方案是:

UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

在方法中

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

差异是:自我。需要将其添加到 Xcode 生成的模板(用于 Master/Detail)。

于 2013-02-22T21:13:16.123 回答