• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UICollectionView Moving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UICollectionView Moving


  • Subject: Re: UICollectionView Moving
  • From: Luke Hiesterman <email@hidden>
  • Date: Mon, 07 Mar 2016 20:45:09 +0000
  • Thread-topic: UICollectionView Moving

You can create your own subclass of UICollectionViewLayoutAttributes and add something like an “isMoving” property to that. Then teach your cell classes to respond to that property by changing the background color.

Luke

On Mar 7, 2016, at 11:44 AM, Luther Baker <email@hidden<mailto:email@hidden>> wrote:

Thanks Luke! That was it - I can drag and drop successfully now.

One more question, how do I modify a property of the item I'm dragging around if the property is NOT currently in UICollectionViewLayoutAttributes ... I don't see a call to the datasource or delegate when I select the cell for moving ... so I'm not sure how to change the background color to "red" for instance.

Would I have to add my own view to the superview and manually move it around in the dragging callbacks?

Thanks!
-Luther


On Mon, Mar 7, 2016 at 11:59 AM, Luke Hiesterman <email@hidden<mailto:email@hidden>> wrote:
I’d check your return value for this method in your layout:

- (UICollectionViewLayoutAttributes *)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath *)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);

Luke

On Mar 7, 2016, at 9:55 AM, Luther Baker <email@hidden<mailto:email@hidden>> wrote:

I followed the directions here,
http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
- to add iOS9 style dragging to my UICollectionView - and it sort of works.

As described in the article, I added a long press gesture recognizer and
wired it in to make calls on the collection view -- but now, if I long
press, the element under my finger disappears. As I drag the transparent
image around, the other elements shift - but I can never see the element I
am dragging around. When I let go, there is simply a hole left where I
"dropped" the element.

I do, very much, have a custom layout and I'm not sure that if, for drag, I
need to do anything special. Do I need to calculate the frame of the item I
am dragging around? I'm not sure what to try next except to roll my own
dragging. Any thoughts or things to try?

Thanks in advance.
_______________________________________________

Cocoa-dev mailing list (email@hidden<mailto:email@hidden>)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com<http://lists.apple.com/>

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden<mailto:email@hidden>



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: UICollectionView Moving
      • From: Luther Baker <email@hidden>
References: 
 >UICollectionView Moving (From: Luther Baker <email@hidden>)
 >Re: UICollectionView Moving (From: Luke Hiesterman <email@hidden>)
 >Re: UICollectionView Moving (From: Luther Baker <email@hidden>)

  • Prev by Date: Re: State Restoration thinks all my windows closes prior to quit
  • Next by Date: Re: UICollectionView Moving
  • Previous by thread: Re: UICollectionView Moving
  • Next by thread: Re: UICollectionView Moving
  • Index(es):
    • Date
    • Thread