UIView-DragDrop icon indicating copy to clipboard operation
UIView-DragDrop copied to clipboard

Incorrect behavior in iOS 8.1

Open ryanmeisters opened this issue 11 years ago • 3 comments

It looks like this category is behaving incorrectly under iOS 8.1. This can be seen in the example project.

Incorrect behavior:

  • All test views are snapping back to their original positions immediately upon touching the drop view.
  • View 2 is returning to its starting position when dragging ends.

Correct behavior:

  • Test views 1, 3, 4 should return to their starting positions (animated) when dropped (on the drop view or not), but only when dropped.
  • View 2 should not return to it's starting position.

I will see if I can get some time to look more closely at this.

ryanmeisters avatar Jan 15 '15 18:01 ryanmeisters

So I looked into this quite a bit, and figured out that it was due to the UILabel's being changed in the middle of the delegate calls.

For some reason in iOS 8, Apple modified behaviour of UILabel such that when you change the text of a label, the constraints for it's superview are updated. Likely due to content hugging, size changes, etc.

Since we are dragging the UIView around without updating the constraints, as soon as the constraint system kicks in and updates, the view that is being dragged reverts back to it's original position.

slangley avatar Jan 15 '15 19:01 slangley

@ryanmeisters @slangley did you all ever make any progress on this behavior in iOS 8.1+? Thanks!

mps avatar Apr 23 '15 12:04 mps

The behaviour works in 8.1 as long as you don't do something mid drag that forces a constraint update. The sample updates the label in the middle of the drag that forces a re layout, causing the view being dragged to have its frame reset.

I have used this category successfully in an app which is fully auto layout based by ensuring I am avoiding the above caveat.

App is here and is drag heavy: http://itunes.apple.com/ca/app/gummii/id669982848?mt=8

On Apr 23, 2015, at 8:59 AM, Matthew Strickland [email protected] wrote:

@ryanmeisters @slangley did you all ever make any progress on this behavior in iOS 8.1+? Thanks!

— Reply to this email directly or view it on GitHub.

slangley avatar Apr 24 '15 10:04 slangley