1

在我的 tableView didSelectRowAtIndexPath 中,我可以访问单元格 textLabel。如何访问部分标签?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    topPlacesAppDelegate *appDelegate = (topPlacesAppDelegate *) [[UIApplication sharedApplication] delegate];  
    appDelegate.chosenPhoto = [self.topPlaces objectAtIndex:indexPath.row];  
. . . 
    UITableViewCell *mycell = [tableView cellForRowAtIndexPath:indexPath];
    NSLog(@"   indexPath.section / Row = %i / %i", indexPath.section, indexPath.row);
    NSLog(@"   textLabel.text          = %@", mycell.textLabel.text);
    NSLog(@"   detailTextLabel.text    = %@", mycell.detailTextLabel.text);

    [self performSegueWithIdentifier:@"Show Site Table" sender:nil];
}
4

1 回答 1

0

听起来您正在寻找表格部分标题。我认为您无法读取或以其他方式访问该数据。但是您可以使用 UITableViewDataSource 上的方法进行设置:

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

此处描述了详细信息:

在运行应用程序时更改 UITableView 部分页眉/页脚?

于 2012-07-27T19:44:44.097 回答