-
Notifications
You must be signed in to change notification settings - Fork 39
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
Allow drop onto empty area of table below last item to add to end of table #18
Conversation
handleDragStartedInSrcAtPoint now correctly calls determineIndexForConta...
…tem to end of table list; also allow rearrange in the same matter - dragged item is swapped with last item in table list
Just a heads up... looks like some extra user metadata files were added to this pull request. |
// Now just construct the index path | ||
indexPath = [NSIndexPath indexPathForRow:([theView numberOfRowsInSection:([theView numberOfSections]-1)]-1) | ||
inSection:([theView numberOfSections]-1)]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if table is empty?
indexPath = <NSIndexPath: 0x918e930> {length = 2, path = 4294967295 - 4294967295}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably do with some additional test cases in the test app to cover scenarios like empty tables. Will put some together when I review/merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steve,
I'll look into your first question about empty table. Should be easy to
address.
On another thought... I wish it were easier to specify a table DataSource
but looks like you have to declare protocol and implement more delegates.
So many cooler things could be done generically if that were the case
rather than hard coding the array with each table. Perhaps some sort of
metadata data structure in the helper could simplify it? Just thinking out
loud.
Craig
On Thu, Mar 13, 2014 at 6:10 AM, Steve Fortune notifications@github.comwrote:
In Classes/I3DragBetweenHelper.m:
@@ -264,6 +264,31 @@ -(NSIndexPath_) determineIndexForContainer:(UIView_) container
}+-(NSIndexPath_) lastIndexPathForView:(UIView_) container{
+
- NSIndexPath *indexPath;
- if([container isKindOfClass:[UITableView class]]){
UITableView _theView = (UITableView_)container;
// Now just construct the index path
indexPath = [NSIndexPath indexPathForRow:([theView numberOfRowsInSection:([theView numberOfSections]-1)]-1)
inSection:([theView numberOfSections]-1)];
We could probably do with some additional test cases in the test app to
cover scenarios like empty tables. Will put some together when I
review/merge.Reply to this email directly or view it on GitHubhttps://github.com//pull/18/files#r10563204
.
Lacrosse Stats Collection for the iPad - Get it on the App
Storehttp://itunes.apple.com/us/app/x-static-apps-lacrosse-stats/id516229459?ls=1&mt=8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, missed your second point. Not quite sure what you mean, could you provide some sort of pseudo-example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking out loud. I need to give it more thought. Once I flesh it
out a bit I'll provide more details or possibly a solution.
On Thu, Mar 13, 2014 at 1:56 PM, Steve Fortune notifications@github.comwrote:
In Classes/I3DragBetweenHelper.m:
@@ -264,6 +264,31 @@ -(NSIndexPath_) determineIndexForContainer:(UIView_) container
}+-(NSIndexPath_) lastIndexPathForView:(UIView_) container{
+
- NSIndexPath *indexPath;
- if([container isKindOfClass:[UITableView class]]){
UITableView _theView = (UITableView_)container;
// Now just construct the index path
indexPath = [NSIndexPath indexPathForRow:([theView numberOfRowsInSection:([theView numberOfSections]-1)]-1)
inSection:([theView numberOfSections]-1)];
Sorry, missed your second point. Not quite sure what you mean, could you
provide some sort of pseudo-example?Reply to this email directly or view it on GitHubhttps://github.com//pull/18/files#r10585519
.
Lacrosse Stats Collection for the iPad - Get it on the App
Storehttp://itunes.apple.com/us/app/x-static-apps-lacrosse-stats/id516229459?ls=1&mt=8
Hi Craig, thanks for the PR - looks cool! I'll merge locally when I get a chance and take a look. It'll probably be over the weekend now though. I don't think we should be tracking userdata files (at least, I usually gitignore them on other proejcts), I'll add it to a .gitignore along with .DS_Store |
Merge and review this on remote branch cvconover-merge as tracked userdata is interfering with my local repo. |
… nil if the supplied container is not a UITableView or UICollectionView, or empty
There are some issues I've found with this PR by running through the test cases and having a look through the source... General issues:
Here are some more details on test-case specific issues:
I'm going to close this for now due to the issues associated with it, but I think it demonstrates how fragile this class is at the moment. Maybe we could come back to it after some refactoring. |
Drag from one table and dropping at the bottom of another table at the bottom below the last item of the drop table adds the dropped item to the end of the drop table.
Rearrange works in similar way. Dropping item below last item of table will swap the dragged item with the last item of the table.