向可滚动全景图像添加按钮-IOS Swift 4

向可滚动全景图像添加按钮-IOS Swift 4,ios,swift,xcode,button,panoramas,Ios,Swift,Xcode,Button,Panoramas,我正在设计一个iOS应用程序,它可以让用户从全景图像视图中选择对象。 用户将能够“环顾四周”(左侧和右侧),并需要从一侧拾取项目 现在的问题是,如何准确跟踪用户在图像中单击的位置?用户可以左右移动、夹入和夹出 使用Apple ARKit不是一个选项,这个应用程序也将在以后为Android开发。所以我对它进行了更多的思考,并采用了不同的方法。 答案是使用以下代码获取图像的坐标: 当用户与焦点交互时,焦点在哪里并不重要,您将获得图像中位置的坐标。 希望这对别人有帮助 @IBOutlet we

我正在设计一个iOS应用程序,它可以让用户从全景图像视图中选择对象。 用户将能够“环顾四周”(左侧和右侧),并需要从一侧拾取项目

现在的问题是,如何准确跟踪用户在图像中单击的位置?用户可以左右移动、夹入和夹出


使用Apple ARKit不是一个选项,这个应用程序也将在以后为Android开发。

所以我对它进行了更多的思考,并采用了不同的方法。 答案是使用以下代码获取图像的坐标: 当用户与焦点交互时,焦点在哪里并不重要,您将获得图像中位置的坐标。 希望这对别人有帮助

    @IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction))
        self.imageView.isUserInteractionEnabled = true
        self.imageView.addGestureRecognizer(tapGestureRecognizer)
    }

@objc func tapAction(sender: UITapGestureRecognizer) {
        let touchPoint = sender.location(in: self.imageView) // Change to whatever view you want the point for
        print(touchPoint)
    }

所以我给了它更多的思考和不同的方法。 答案是使用以下代码获取图像的坐标: 当用户与焦点交互时,焦点在哪里并不重要,您将获得图像中位置的坐标。 希望这对别人有帮助

    @IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction))
        self.imageView.isUserInteractionEnabled = true
        self.imageView.addGestureRecognizer(tapGestureRecognizer)
    }

@objc func tapAction(sender: UITapGestureRecognizer) {
        let touchPoint = sender.location(in: self.imageView) // Change to whatever view you want the point for
        print(touchPoint)
    }

看起来您可以将UICollectionView用于所需的行为。现在检查它看起来您可以将UICollectionView用于所需的行为。现在检查它