rename touch actions; better comment

This commit is contained in:
nixzhu
2015-10-16 13:43:15 +08:00
committed by nixzhu
parent 0378d3a335
commit a899a7fe71
2 changed files with 13 additions and 13 deletions
@@ -343,18 +343,18 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate {
self?.performSegueWithIdentifier("showFeedMedia", sender: info)
}
// simulate select effects when tap on cell.mediaCollectionView's space part
// simulate select effects when tap on messageTextView or cell.mediaCollectionView's space part
cell.mediaCollectionViewTouchesBeganAction = { [weak self] in
cell.touchesBeganAction = { [weak self] in
self?.tableView(tableView, willSelectRowAtIndexPath: indexPath)
tableView.selectRowAtIndexPath(indexPath, animated: false, scrollPosition: .None)
}
cell.mediaCollectionViewTouchesEndedAction = { [weak self] in
cell.touchesEndedAction = { [weak self] in
delay(0.03) {
self?.tableView(tableView, didSelectRowAtIndexPath: indexPath)
}
}
cell.mediaCollectionViewTouchesCancelledAction = {
cell.touchesCancelledAction = {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
+9 -9
View File
@@ -29,9 +29,9 @@ class FeedCell: UITableViewCell {
var tapAvatarAction: (() -> Void)?
var tapMediaAction: ((transitionView: UIView, imageURL: NSURL) -> Void)?
var mediaCollectionViewTouchesBeganAction: (() -> Void)?
var mediaCollectionViewTouchesEndedAction: (() -> Void)?
var mediaCollectionViewTouchesCancelledAction: (() -> Void)?
var touchesBeganAction: (() -> Void)?
var touchesEndedAction: (() -> Void)?
var touchesCancelledAction: (() -> Void)?
var attachmentURLs = [NSURL]() {
didSet {
@@ -96,24 +96,24 @@ class FeedCell: UITableViewCell {
avatarImageView.addGestureRecognizer(tapAvatar)
messageTextView.touchesBeganAction = { [weak self] in
self?.mediaCollectionViewTouchesBeganAction?()
self?.touchesBeganAction?()
}
messageTextView.touchesEndedAction = { [weak self] in
self?.mediaCollectionViewTouchesEndedAction?()
self?.touchesEndedAction?()
}
messageTextView.touchesCancelledAction = { [weak self] in
self?.mediaCollectionViewTouchesCancelledAction?()
self?.touchesCancelledAction?()
}
let backgroundView = TouchClosuresView(frame: mediaCollectionView.bounds)
backgroundView.touchesBeganAction = { [weak self] in
self?.mediaCollectionViewTouchesBeganAction?()
self?.touchesBeganAction?()
}
backgroundView.touchesEndedAction = { [weak self] in
self?.mediaCollectionViewTouchesEndedAction?()
self?.touchesEndedAction?()
}
backgroundView.touchesCancelledAction = { [weak self] in
self?.mediaCollectionViewTouchesCancelledAction?()
self?.touchesCancelledAction?()
}
mediaCollectionView.backgroundView = backgroundView
}