2013-08-28 40 views
1

我在我使用的tableView顯示的數據,但問題是,它並沒有顯示的tableView數據這裏是設置單元格的值的UITableView不顯示在iPad上的應用程序數據

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 
            reuseIdentifier:CellIdentifier] autorelease]; 
     cell.selectionStyle = UITableViewCellSelectionStyleBlue; 
    } 

    if (tableView == tableCategory) { 

     cell.textLabel.font=[UIFont fontWithName:@"Arial" size:16]; 
     cell.textLabel.textAlignment=UITextAlignmentLeft;  

     ObjectData*theCellData = [categoryArray objectAtIndex:indexPath.row]; 
     cell.textLabel.text=theCellData.categoryTitle; 

     return cell; 
    } 
    else if (tableView == tableSubCategory) 
    { 
     cell.textLabel.font=[UIFont fontWithName:@"Arial" size:16]; 
     cell.textLabel.textAlignment=UITextAlignmentLeft;  
     ObjectData*theCellData = [subCategoryArray objectAtIndex:indexPath.row]; 

     NSString *test = theCellData.subCategoryTitle; 
     NSLog(@"Test Cell is %@",test); 
     cell.textLabel.text = test; 

     return cell;  
    } 
    else if(tableView == tablePublish) 
    { 
     cell.textLabel.font = [UIFont fontWithName:@"Arial" size:16]; 
     cell.textLabel.textAlignment = UITextAlignmentLeft;  

     GetPublishData *theCellData = [publishArray objectAtIndex:indexPath.row]; 
     NSString *test = [NSString stringWithFormat:@"%@:%@:%@ in:%@:%@",theCellData.UserName,theCellData.ContentTitle,theCellData.ContentType,theCellData.Catgeory,theCellData.SubCategory]; 
     NSLog(@"Test Cell is %@",test); 
     cell.textLabel.text = test; 
     cell.detailTextLabel.text = theCellData.ContenAddedTime; 

     return cell; 
    } 
    else 
    { 
     cell.textLabel.font = [UIFont fontWithName:@"Arial" size:16]; 
     cell.textLabel.textAlignment = UITextAlignmentLeft; 

     GetPublishData *theCellData = [publishArray objectAtIndex:indexPath.row]; 

     NSString *test = theCellData.ContentDescription; 
     cell.textLabel.text = test; 

     return cell; 
    } 
} 

我的代碼的iPad應用程序有tableView委託和dataSource但仍然沒有顯示任何東西,而檢查計數陣列它顯示的項目,但不顯示數據在tableview 我顯示的數據其他表不工作

+1

您可以編輯您的問題,並顯示你的整個方法' - (UITableViewCell的*)的tableView:(UITableView的*)的tableView的cellForRowAtIndexPath:(NSIndexPath *)indexPath' – zbMax

+0

@zbMax編輯請檢查代碼 –

+0

是否調用過表視圖方法? – Wain

回答

0

什麼返回你的方法 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection :(NSInteger)節?你能顯示你的代碼嗎?

另外,檢查是否爲所有表設置了委託和數據源。

不好意思發表這個回覆。我沒有評論發佈的聲譽。

+0

這是好的沒有問題,我已經設置所有表的代表和數據源 –

+0

那麼numberOfRowsInSection方法呢?你可以檢查嗎?這張桌子應該有多少行? – iShmidt

+0

他們也顯示數組完美,但它不顯示在單元格 –

0

檢查單元標識符..你給了表單元格的任何自定義單元標識符嗎?在這裏你都在提它作爲

NSString *CellIdentifier = @"Cell"; 
+0

是的,我提到它是這樣的 –

相關問題