I have been trying to drag a custom UITableViewCell between two UITableViews.
I found this post but I'm still only able to get things to drag within one view (the code here doesn't really seem to do anything.. but the guy claims it works):
So the first thing I did was create an empty View Based Project. Then I added two IBOutLets to the 'main' Controller, these being my 'UITableViews'. Then I went into Interface Builder and added two table views, made a connection to File Owner for the delegate and dataSource. And a connection with the IBOutlets for each of the tables.
Then within the controller I have various methods which now go something like this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == self.firstTable) {
//do something
}
else{ //only two views
// do something else for second table view
}
My two main problems with the other post are that I'm not sure what kind of class the "Person" object he talks about is. In my case I just made a UIView and colored it red... so that is my "Person". I then created a UITableViewCell and add this UIView to it.... but it almost seems that the Person object in the post is not a UIView...
The main problem though is where to add the hitTest method. I decided to add it to the "main" Controller (same as what I use for the TableViews), and things were not working so I did this instead:
- (UIView*) hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *rv = nil;
for(UIView *child in self.view.subviews){
if( [child isKindOfClass:[ItemView class]] ){
rv = child;
child.center = point;
break;
}
}
if( rv == nil ){
rv = [super hitTest:point withEvent:event];
}
return rv;
}
The problem as you can see is that I had to change the reference so I go self.view.subviews instead of just self.subviews.
I would appreciate if someone could provide some code, its a bit hard to find much info online on how to do this and many people seem to be looking for a way of doing this.
NOTE: I'm also in the process of looking at the DragKit...