数据没有显示在iphone tableView

问题描述:

我从json获取数据。它工作正常,但问题是数据不显示在tableView中。数据没有显示在iphone tableView

我检查了使用NSLog分配给单元格的值,但单元格不显示任何数据。

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    return 1; 
} 

// Customize the number of rows in the table view. 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    int count = [surveyList count]; 
    NSLog(@"These are rows %d",count); 
    return [surveyList count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) 
    { 
     cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
    } 
    ObjectData *data = [surveyList objectAtIndex:indexPath.row]; 
    NSString *testingClient = data.survey_title; 
    NSLog(testingClient); 
    NSString *cellText = testingClient; 
    return cell; 
} 
+0

确保分配委托给你的表视图, – DivineDesert 2012-07-27 04:25:03

+0

是的,我已经指派delagate有人告诉tableviewrealod数据创建类似的问题,但我还没有重新加载任何东西 – user1553768 2012-07-27 04:28:18

你是否错过了这个?

[[cell textLabel] setText:testingClient]; 

你是不是没有它分配任何文本的单元格。

+0

我也给了这个 – user1553768 2012-07-27 04:47:15

您应该指定该文本单元的标签。

cell.textLabel.text = testingClient; 
+0

是的,我已经做了这样也 – user1553768 2012-07-27 04:39:33

+0

第一次尝试加载一些虚拟数据到你的桌子..确保你的桌子被填充并且工作正常。找到一个教程做一个tableView – Zaraki 2012-07-27 04:44:50