【问题标题】:Drawing a UIImageView at position of user tap在用户点击的位置绘制 UIImageView
【发布时间】:2010-06-04 23:04:05
【问题描述】:

这是我第二次问这个问题。每次用户点击屏幕时,如何在用户点击的位置绘制图像?

您能否留下一个示例项目或代码,因为我是 iPhone 编程的新手,并且很难理解某些方法等。 谢谢, 泰特

【问题讨论】:

标签: iphone uiimageview touch


【解决方案1】:
- (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];
}

以后,请阅读文档或使用 Google。

【讨论】:

  • 好的,非常感谢,很抱歉,但我真的不喜欢文档。再次谢谢你。泰特
  • 无论您是否喜欢该文档,您都必须使用它。您不能总是要求其他人为您提供代码。购买许多 iPhone 书籍中的一本或遵循一些在线教程可能是值得的。谷歌似乎很擅长找东西。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-19
  • 1970-01-01
  • 1970-01-01
  • 2014-09-19
  • 1970-01-01
  • 1970-01-01
  • 2020-11-12
相关资源
最近更新 更多