Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Basically, you would need to build the functionality yourself. You could do this by <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesBegan:withEvent:" rel="nofollow noreferrer">listening to touches</a> in a superview that includes the full draggable area. The method <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/hitTest:withEvent:" rel="nofollow noreferrer"><code>hitTest:withEvent:</code></a> can tell you if the touch down point is in the label to be dragged.</p> <p>From there, you can override the <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesMoved:withEvent:" rel="nofollow noreferrer"><code>touchesMoved:withEvent:</code></a> method to update the position of the <code>UILabel</code> to keep it aligned with the finger. Updating the position of the label will automatically redraw it for you.</p> <p><a href="https://stackoverflow.com/questions/979555/iphone-drag-drop">Here's a relevant question for iphone drag/drop</a>.</p> <p>Once you get the dragging working, I would also recommend paying attention to the location within the <code>UILabel</code> where the first touch was made, and handle the repositioning in such a way that the finger is always on that point within the <code>UILabel</code>. An easier-to-code but worse-looking version is to simply reposition, say, the upper-left corner of the label to be where the finger is, but this could make the label appear to jump when it first starts dragging.</p> <p>It may sound intimidating, but it's really not that bad -- just a few lines of code in total. Unless you have views that might overlap. That's another few lines, depending on how you want to handle it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload