Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Implement item move on iOS CollectionView #4863

Merged
merged 2 commits into from Jan 7, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -21,7 +21,6 @@ public ObservableItemsSource(IEnumerable itemSource, UICollectionView collection

void CollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
{
// TODO hartez 2018/07/31 16:02:50 Handle the rest of these cases (implementing selection will make them much easier to test)
switch (args.Action)
{
case NotifyCollectionChangedAction.Add:
@@ -33,6 +32,7 @@ void CollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
case NotifyCollectionChangedAction.Replace:
break;
case NotifyCollectionChangedAction.Move:
Move(args);
break;
case NotifyCollectionChangedAction.Reset:
break;
@@ -41,6 +41,14 @@ void CollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
}
}

private void Move(NotifyCollectionChangedEventArgs args)
This conversation was marked as resolved by hartez

This comment has been minimized.

Copy link
@paymicro

paymicro Dec 26, 2018

Collaborator

drop private

This comment has been minimized.

Copy link
@hartez

hartez Dec 27, 2018

Author Member

Fixed.

{
var oldPath = NSIndexPath.Create(0, args.OldStartingIndex);
var newPath = NSIndexPath.Create(0, args.NewStartingIndex);

_collectionView.MoveItem(oldPath, newPath);
}

static NSIndexPath[] CreateIndexesFrom(int startIndex, int count)
{
var result = new NSIndexPath[count];
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.