2012-04-21 31 views
1

在我的tableView didSelectRowAtIndexPath中,我可以訪問單元格textLabel。如何訪問部分標籤?如何從didSelectRowAtIndexPath訪問UITableView部分標籤

- (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]; 
} 

回答

0

這聽起來像你正在尋找表節標題。我不認爲你可以閱讀或以其他方式訪問這些數據。但是你可以設置它在UITableViewDataSource方法:

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

詳細描述如下:

Change UITableView section header/footer WHILE RUNNING the app?