ios - UIScrollView contentOffset animates to another point -


good day, i'm facing wired behavior in uiscrollview here. i'm implementing custom circular uiscrollview , in point i've set origin of scroll view point

scrollview.setcontentoffset(cgpoint(x: 0, y: 0), animated: false) 

after change content offset using animation specific point

scrollview.setcontentoffset(cgpoint(x: point, y: 0), animated: true) 

the problem although point correct (ex. 400) scrollview jumps point code following should print 10 if point = 10 prints other values.

scrollview.setcontentoffset(cgpoint(x: point, y: 0), animated: true)                         dispatchqueue.main.asyncafter(deadline: .now() + 1, execute: {                         print("current x: \(self.tabsscrollview.contentoffset.x)")}) 

although made sure no other animation in progress.

i found suggesting

uiview.animate(withduration: 0.5, animations: {                          self.scrollview.contentoffset.x = point                     }) 

and surprisingly did work, not animated default. ideas?


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -