Hi! I am trying to position a UIImageView on my view. I initialized it programmatically. When I use initWithFrame, the UIImageView shows up, but at the top left corner of the screen instead of where I told it to be. I did tell the image within the UIImageView to be at the upper left corner, but that should be within the UIImageView, right? Here is my code:
This is where I initialize the UIImageView:
Code:
// Draw NADH
nadh = [[NadhView alloc] init:CGPointMake(300, 300)];
And here is the init method in my NadhView class:
Code:
- (id)init:(CGPoint)initialPoint {
//Set frame and image
self.image = [UIImage imageNamed:@"nadh.png"];
self.drawPoint = initialPoint;
CGRect rectangle = CGRectMake(drawPoint.x, drawPoint.y, image.size.width, image.size.height);
//Make the view and draw the image
[self initWithFrame:rectangle];
CGPoint point = CGPointMake(0, 0);
[image drawAtPoint:point];
return self;
}
(NadhView is a subclass of UIImageView)
Any help would be appreciated. Thanks!