开发者

Drawing a UIImageView at position of user tap

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 programm开发者_运维问答ing and have a hard time understanding certain methods etc. Thanks, Tate


- (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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜