2012-08-06 52 views

回答

10

的indexPath參數有訪問截面屬性如下

[indexPath section]; 

OR

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

if(indexPath.section==0) 
{ 

    // 1st Section of the tableView. 

    if(indexPath.row==0) 
    { 

     // 1st cell of the 1st section. 

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

    int section = [indexPath section]; 

} 
2
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath: 
(NSIndexPath*)indexPath{ 
    int section = [indexPath section]; 
    NSLog(@"section %d",section); 
} 
相關問題