When is PHFetchResultChangeDetails's “hasMoves” equal to YES?

独自空忆成欢 提交于 2019-12-13 03:48:01

问题


I'm writing my subclasses of PHChange along with PHFetchResultChangeDetails. I understand fields like insertedIndexes, insertedObjects, fetchResultBeforeChanges, fetchResultAfterChanges etc.

What I can't understand is a field hasMoves. Documentation says that it's "A Boolean value that indicates whether objects have been rearranged in the fetch result".

So my questions are:
1. What should the user do to reproduce the case when hasMoves = YES ?
2. If hasMoves = YES can the moves be calculated out of insertedIndexes\ changedIndexes \ removedIndexes, or don't I have access to the information about moves?


回答1:


Well, it is possible to rearrange photos in the custom albums (but not the standard ones like CameraRoll, Favorites etc):

Open the album you want to organize. Hold your finger gently on the photo you want to move, then drag it to a different position. Release your finger to drop it into the new position.

Programmatically, PHAssetCollectionChangeRequest can be used:

- (void)replaceAssetsAtIndexes:(NSIndexSet *)indexes 
                withAssets:(id<NSFastEnumeration>)assets;


来源:https://stackoverflow.com/questions/56541322/when-is-phfetchresultchangedetailss-hasmoves-equal-to-yes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!