Skip to content

Commit

Permalink
Current status before upgrading to Swift 3 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyrea committed Sep 24, 2016
1 parent 7b6850f commit aee3c9a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions JRLongPressGestureHandler/Source/JRLongPressGestureHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ public class JRLongPressGestureHandler {
snapshot?.center = center

if cellMoved(sourceIndexPath!, indexPath: indexPath!) {

print("cell center: ", center.y)
print(tableView.frame.height + tableView.contentOffset.y - 88)
print("--------")


// Scrolling
if(center.y > tableView.frame.height + tableView.contentOffset.y - 65 && indexPath!.row + 1 < tableView.numberOfRowsInSection((indexPath?.section)!)) {
indexPath = NSIndexPath(forRow: indexPath!.row + 1, inSection: indexPath!.section)

UIView.animateWithDuration(0.5, animations: { () -> Void in
tableView.scrollToRowAtIndexPath(indexPath!, atScrollPosition: .Bottom, animated: false)
})
} else if (center.y - tableView.contentOffset.y < 64 + 65 && indexPath!.row - 1 >= 0) {
// 64 is height of navigation bar + status bar
// indexPath = NSIndexPath(forRow: indexPath!.row - 1, inSection: indexPath!.section)

UIView.animateWithDuration(0.5, animations: { () -> Void in
tableView.scrollToRowAtIndexPath(indexPath!, atScrollPosition: .Top, animated: false)
})
}

displaceCellAnimation(tableView, indexPath: indexPath!)
}

Expand Down

0 comments on commit aee3c9a

Please sign in to comment.