问题
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