0

我正在处理xmlparser和显示来自[this xml]mytableview 的数据。如您所见,第一行未与其他行对齐。

这是填充行的方式:

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Configure the cell.
    cell.textLabel.text = [((AlbumObject *)[listFeed objectAtIndex:indexPath.row]) title];

    return cell;
}

我错过了一些明显的东西吗?

在此处输入图像描述

已解决正如您所建议的,问题是我从 xml 中看不到一些空格。这解决了:

[currentStringValue appendString:[string
                             stringByTrimmingCharactersInSet:[NSCharacterSet
                                                              whitespaceAndNewlineCharacterSet]]];
4

1 回答 1

0

正如您所建议的,问题是我从 xml 中看不到一些空格。这解决了:

[currentStringValue appendString:[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
于 2012-05-21T07:10:24.757 回答