ios - What do I have to do after setting contentInset or automaticallyAdjustsScrollViewInsets for it to actually beeing applied? -


i have got uiviewcontroller containing uiscrollview. automaticallyadjustsscrollviewinsets not set (so should default yes).

on user interaction set automaticallyadjustsscrollviewinsets no, can set own contentinset on scroll view.

after doing nothing happens. have call afterwards?

calling setneedsdisplay on scroll view doesn’t help.

if want initial display of scrollview include initial content offset, set contentinset value in viewdidload. if wish dynamically change contentinset , have contentoffset change well, need adjust contentoffset @ same time contentinset. example:

// adjust content inset , initial offset account header uiedgeinsets contentinset = self.collectionview.contentinset; contentinset.top += self.stickyheaderview.bounds.size.height; self.collectionview.contentinset = contentinset; if (-1 * self.collectionview.contentoffset.y < contentinset.top) {     cgpoint contentoffset = self.collectionview.contentoffset;     contentoffset.y = -1*contentinset.top;     [self.collectionview setcontentoffset:contentoffset animated:yes]; } 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -