<分区>
标签 ios uiimageview tap
我正在尝试制作一个应用程序,您可以在其中粘贴以“开火”,点击它会使图像出现,也就是弹孔。我意识到我将不得不显示一个 UIImageView
,但我不知道如何显示。
感谢任何帮助
最佳答案
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
NSLog(@"X cord: %f",location.x);
NSLog(@"Y cord: %f",location.y);
}
在上面的代码中,您将获得当前的触摸位置。因此,将您的图像放在该位置。 希望它能帮助你。
关于ios - 点击屏幕时加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18525070/