Add a uiimageview inside a uiview when touching the uivew
<p>What I want to do is when I touch the <code>UIView</code>, I want to add an image at the touched location.</p>

<p>This is my code I have for the moment.
(I have tried to replace x and y with <code>touchLocation</code> in the <code>CGRectMake</code>, but that doesn't work).</p>

<p><strong>Edited</strong>
After clean and restart xcode it work.</p>

<pre><code>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [touches anyObject];
    CGPoint touchLocation = [touch locationInView:touch.view];

    if ([touch view] == GrassView) {

        NSLog(@"Hit grass");

        UIImageView *imageViewFlower =[[UIImageView alloc] initWithFrame:CGRectMake(0,0,50,50)];
        imageViewFlower.center = touchLocation;
        imageViewFlower.image= [UIImage imageNamed:@"whiteflower.png"];
        [GrassView addSubview:imageViewFlower];

    }
}
</code></pre>

<p>Thanks for any help!</p>