0

I have a .plist with a lot of names.
A table view displays all the information from the .plist.
Also an image with the same name as the string is added to the cell.

Almost everything works fine, just the names that have special characters does not show the image.

Working:
<string>The Name</string>
I have an image called "The Name.png"

It Works.

Not Working:
<string>The Name vs. "Me"</string>
I have an image called "The Name vs. "Me".png"

The image does not show up.

Why ? How can I make it work ?

Thanks.

Adding the info requested.

Plist.
<dict>
<key>Name</key>
<string>A</string>
<key>type</key>
<array>
<string>The Name</string>
<string>The Name vs. "Me"</string>
</array>
</dict>

Code to call the image to the cell.
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
imgView.image = [UIImage imageNamed:nombreDeDOEnFila];
cell.imageView.image = imgView.image;

More code to show how its being used.

// Configure the cell.
NSString *nombreDeDOEnFila = [type objectAtIndex:row];
cell.textLabel.text = nombreDeDOEnFila;

// Call image
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
imgView.image = [UIImage imageNamed:nombreDeDOEnFila];
cell.imageView.image = imgView.image;

#pragma mark - Table view delegate

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

NSString *nombreDeDOEnFila = [type objectAtIndex:row];
moreInfoController.name = nombreDeDOEnFila;

4

1 に答える 1

0

plist エディターの文字列は、エスケープされていない文字列です。引用符をエスケープする必要があります

<string>The Name vs. \"Me\"</string>

于 2012-09-10T17:04:19.710 に答える