views:

39

answers:

1

morning all, I've been browsing around trying to work out what I've done wrong when trying to add a thumbnail to a gallery view, but can't work out what on earth it might be. I'm trying to use the following code to stick a thumbnail onto a blank view:

UIImageView *any = [[UIImageView alloc] initWithFrame:CGRectMake(a,b,70,60)];
any.image = [UIImage imageNamed:selectedThumbPath];
any.tag = 0;
[self.view addSubview:any];

In the above example:

a = 165
b = 150
selectedThumbPath = the full path to a thumbnail ie. /users/Cleverbum/library etc

I'm pulling my hair out, there are no error messages, and no clues as to why it's not drawing anything. What's worse is that this is one of the only parts of the code i've not changed!

+1  A: 

I ran into a problem similar to this a while back. If I recall, imageNamed: only seemed to work on images in my project. Try looking into imageWithContentsOfFile: and pass it the NSFile from that path.

Staros
Thank you, I've been staring at that for three hours. You've just saved me from having to buy a new computer, after throwing this one out of the window!
Martin KS