ios - Setting content offset of a UITableView not working when it's scrolling -
here's code
// 1 func scrollviewdidenddragging(scrollview: uiscrollview, willdecelerate decelerate: bool) { scrolltableview() } // 2 @ibaction func buttonpressed() { scrolltableview() } // 3 func scrolltableview() { tableview.setcontentoffset(cgpointzero, animated: false) // tableview.scrollrecttovisible(cgrect(x: 0, y: 0, width: 1, height: 1), animated:true) // not work either }
even method 1 (who calls method 3) being called, table view continues natural scrolling decelerating until stops. not position want.
when table view not scrolling , call method 2 pressing button content offset set , positions should.
how can work being called in method 1?
thanks
if got right following should work:
func scrollviewwillbegindecelerating(scrollview: uiscrollview) { scrolltableview() }