search

Home  >  Q&A  >  body text

objective-c - iOS中拖动imageview,怎么设置拖动范围

目前知道怎么自由拖动imageview了,可是不知道怎么才能让它只能在制定范围内拖动呢?求教

漂亮男人漂亮男人2852 days ago767

reply all(3)I'll reply

  • 習慣沉默

    習慣沉默2017-05-02 09:23:31

    Who come, help me

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:23:31

    This question is also a drunk one. Looking at the username, is the questioner a girl? A little thought on this issue will yield results.

    A simple answer:
    You need to set a range, and then determine whether it touches the edge based on the position of the imageView. If so, then you are not allowed to continue dragging in that direction.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:23:31

    既然你知道能拖动,那么在动的时候判断一下是否到了你指定的边缘,要是到了边缘,不让他移动即可。

    reply
    0
  • Cancelreply