views:

190

answers:

1

Hello, This is the 2nd time I have asked this. How do I draw an image at the location of the user's tap every time the user taps the screen?

Could you please leave a sample project or code because I am new to iPhone programming and have a hard time understanding certain methods etc. Thanks, Tate

A: 
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch * touch = [touches anyObject];

    UIImageView * anImageView = [[UIImageView alloc] initWithImage:anImage];
    [anImageView setCenter:[touch locationInView:self.view]];
    [self.view addSubview:anImageView];
    [anImageView release];
}

In the future, read the documentation or use Google.

Tom Irving
Ok thank you so much I'm sorry but I really don't like the documentation. Again thank you.Tate
allthewayapps
Whether or not you like the documentation, you're going to have to use it. You can't always just ask other people to provide you with the code. It might be worth buying one of the many iPhone books or following some online tutorials. Google seems pretty competent at finding stuff.
Tom Irving