Question : UIImage app - Placing an Image at x,y

Hi
In xcode,

what project type should I use  (iPhone SDK v 4)
and how do I set up a project to make an app to draw an image to the screen at x,y
and listen for taps/clicks
?

Answer : UIImage app - Placing an Image at x,y

There is -drawAtPoint: method in UIImage, if I understand the question.

If you have a UIView and need to set an image as a background, this code will help:

UIColor* bKColor = [[UIColor alloc] initWithPatternImage[UIImage imageNamed: @"MyBkgnd.png"]];
self.view.backgroundColor = bkColor;
[bkColor release];

If you need to draw something in a view, you can use drawInRect: method.
In the view .m file you usually have:
- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    // Drawing code
}

In the initWithFrame you can initialize the image and in drawInRect draw it.
For example so:
- (void)drawRect:(CGRect)rect {
        CGContextRef context = UIGraphicsGetCurrentContext();
        UIImage *myImage = [UIImage imageNamed:@"anImage.jpg"];
        CGPoint imagePoint = CGPointMake(10, 10);
        [myImage drawAtPoint:imagePoint];
        [myImage release];
}

Do you see the following line: [myImage drawAtPoint:imagePoint]; ?
it draws the image at point 10, 10.

I can recommend you this tutorial:
iPhone SDK: Learning About Touch Events & Basic Game Animation
http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk-learning-about-touch-events-basic-game-animation/
Random Solutions  
 
programming4us programming4us