gpt4 book ai didi

ios - 根据坐标在 UIImageView 上找到触摸区域(国家)

转载 作者:行者123 更新时间:2023-11-29 02:27:58 26 4
gpt4 key购买 nike

enter image description here

我正在使用带有地球图像的 UIImageView,如果我触摸任何区域 例如,如果我触摸任何非洲国家,我想触发触摸事件并显示它是用户点击的特定国家。我接近获取图像坐标的方法,请给我任何建议,我怎样才能在国家/地区明智地获得触摸位置。提前致谢。

最佳答案

在纵向模式下将图像放入 ViewController 的 UIImageView 中

实现

  override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

let touch = touches.anyObject() as UITouch
println(touch.locationInView(self.view))

}

结果

(155.5,164.5)

关于ios - 根据坐标在 UIImageView 上找到触摸区域(国家),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27269944/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com