View Full Version : UIImageView Placement (IPhone)

Apr 2, 2008, 05:22 PM
I am using this code to place an image but it doesn't seem to work. The image just gets shown at 0,0

UIImage *image = [UIImage imageNamed:@"image.png"];
CGPoint imagepoint = CGPointMake(272,0);
[image drawAtPoint:imagepoint];
UIImageView *imageview = [[UIImageView alloc] initWithImage:(UIImage *)image];
[window addSubView:imageview];

from the class documentation this seems to be the proper way to do things.

what am I doing wrong?

Apr 2, 2008, 05:53 PM
thank you, i added this lines in and took out the [image:drawAtPoint] stuff

CGRect imageframe = CGRectMake(100,0,44,600);
UIImageView *imageview = [[UIImageView] initWithFrame:imageframe];
imageview.image = image;

it works now