2012-08-13 59 views
1
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    static NSString *CellIdentifier = @"CustomCell"; 

    CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; 
     for (id currentObject in topLevelObjects){ 
      if ([currentObject isKindOfClass:[UITableViewCell class]]){ 
       cell = (CustomCell *) currentObject; 
       break; 
      } 
     } 
    } 
    cell.nameLabel.text = [arrareasdata objectAtIndex:indexPath.row]; 
    cell.designLabel.text = [arrareasdata1 objectAtIndex:indexPath.row]; 

    if(([arrareasdata2 objectAtIndex:indexPath.row].length > 0) 
    { 
     cell.emailLabel.text = [arrareasdata2 objectAtIndex:indexPath.row] 
    } 
    else 
    { 
     cell.emailLabel.text = @""; 
    } 

    cell.webLabel.text = [arrareasdata3 objectAtIndex:indexPath.row]; 


    return cell; 
} 
+1

,在提問之前請仔細閱讀該網站的規則。 – Hassan 2012-08-13 12:59:53

+1

是什麼問題? – holex 2012-08-13 13:05:24

回答

1

問題的目的不是發現這裏

if(([arrareasdata2 objectAtIndex:indexPath.row].length > 0) 

你必須做的是從陣列獲取對象,並將其扔在適當的類型。例如,如果在數組中的對象是NSString類型,然後做以下

NSString *value = (NSString*)[arrareasdata2 objectAtIndex:indexPath.row]; 

然後在if語句檢查長

if (value.length > 0)