2015-11-19 58 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。 –