PDA

View Full Version : UIImageView don't show image




nightwar00
Jun 15, 2009, 09:24 AM
hi there.
I have a little problem with an UIImageView.
I have improve my SDK to version 3.0 (before 2.2) and the UIImageView don't want to show the image i load :

menuImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menuImage.png"]];
[self addSubview:menuImage];
I don't understand why.... is something wrong with the new SDK?
please help



kainjow
Jun 15, 2009, 09:33 AM
Make sure the frame on the UIImageView is what you want. I'm not sure if that method sets the frame size, but most likely the frame origin is not where you want it.

nightwar00
Jun 15, 2009, 09:37 AM
thanks for answer.
I put this code and it doesn't work ...
menuView.frame = CGRectMake(0, 0, 200, 200);

robbieduncan
Jun 15, 2009, 09:43 AM
Are you sure the UIImage is correctly initialising? Can you split the UIImage creation into it's own statement and check that it's not nil?

nightwar00
Jun 15, 2009, 09:53 AM
I have print the value of menuView pointer and i found "0" before initialing and "19580" after so the pointer is correctly initialing..... I don't understand ....
With other project (apple project) the image are correctly display.... Am i missing one line of code ?

i don't understand, in addition my prject display image with sdk 2.2... when i moved to 3.0 the image doesn't display .

any help?