views:

874

answers:

5

Hello, I have got something strange: This Code does NOT Work: cell.imvstatus.image = [UIImage imageNamed:[[tutorials objectAtIndex:indexPath.row] objectForKey:@"image"] ];

This code works:

cell.imvstatus.image = [UIImage imageNamed:@"ROR.png" ];

And in the object there is the value "ROR.png"

Whats the problem at the above one?

How can I find out a solution? Do i have to cast it to a string ?

A: 

Try casting it as a string like this:

NScell.imvstatus.image = [UIImage imageNamed: (NSString *) [[tutorials objectAtIndex:indexPath.row] objectForKey:@"image"] ];

The key is the (NSString *).

Alexsander Akers
A: 

The only thing we can assume is [[tutorials objectAtIndex:indexPath.row] objectForKey:@"image"] doesn't contain ROR.png.

Try doing NSLog debugging by adding the following lines of code (and looking at the console output, in Xcode under the menu Run > Console):

NSLog(@"tutorials: %@", tutorials);
NSLog(@"row index: %d", indexPath.row);
NSLog(@"row content: %@", [tutorials objectAtIndex:indexPath.row]);
NSLog(@"image: %@",
   [[tutorials objectAtIndex:indexPath.row] objectForKey:@"image"]);

There probably is something unexpected there.

duncanwilcox
A: 

not important look at another answer please

Ploetzeneder
A: 

Ok I have found it out:

image = "ROR.png\n"; contains a \n

I have to replace it.BUT:

OK now The Output is: 2009-11-09 09:17:31.606 remotegui[1667:207] image: ROR.png But when i write out the length of the string the string is 8 chars long:

2009-11-09 09:17:31.606 remotegui[1667:207] bildlength: 8

Ploetzeneder
A: 

OK I Solved the problem the replacement was wrong

Ploetzeneder