2015-11-19 66 views
0

我在找这样的一个类似的实现:https://github.com/umano/AndroidSlidingUpPanel 但是对于iOS。目前我有一个带有UITableView的ViewController。我重写此方法,这样我就可以扩大自来水名单:iOS滑动UITableView

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 
    print("selected: \(indexPath.row)") 
    self.view.layoutIfNeeded() 
    UIView.animateWithDuration(1, animations: { 
     self.mTableViewTopConstant.constant = 200 
     self.view.layoutIfNeeded() 
    }) 
} 

我现在想是这样的:如果列表扩大,滚动位置是在顶部,当我移动了我的手指(快速扫)列表中,列表应该折叠。另外,如果可能的话,当我移动手指时,该列表应该遵循我的指示。我深入研究了UIScrollViewDelegate,但是我没有找到在滚动列表时触发的方法。有没有?

+0

这是你的意思吗?或者我理解你错了吗? –

+0

谢谢,会检查出来。 –

回答

0

您在UIScrollViewDelegate中滚动时未找到触发的方法?!? :-)

https://developer.apple.com/library/prerelease/ios//documentation/UIKit/Reference/UIScrollViewDelegate_Protocol/index.html

  • scrollViewDidScroll:
  • scrollViewWillBeginDragging:
  • scrollViewWillEndDragging:withVelocity:targetContentOffset:
  • scrollViewDidEndDragging:willDecelerate:
  • scrollViewShouldScrollToTop:
  • scrollViewDidScrollToTop:

选择一个伴侣:-)

+0

对不起,也许我没有解释正确。这些事件只会触发一次。我需要一个事件,在我滚动时(不离开手指)持续触发并报告当前offSet。 –