ios - Keeping a footer on screen in UICollectionView during an Add -


i have standard flowlayout uicollectionview (scrolling vertically, single section, fixed size items, variable number of columns (e.g. 2 in iphone landscape v 1 in horiz v 3 or 4 on ipad). i'm using nsfetchedresultscontroller manage items displayed core data.

i have add button in footer supplementary add new item. when user presses add button, naturally want add item, want add button remain on screen (scrolling if necessary), can press again.

i check in additem routine:

uicollectionviewlayoutattributes * footerinfo = [self.collectionview layoutattributesforsupplementaryelementofkind:uicollectionelementkindsectionfooter atindexpath:[nsindexpath indexpathforrow:0 insection:0 ]]; [self.collectionview scrollrecttovisible:footerinfo.frame animated:yes]; 

this works well, except when frc adds item on next runloop, collectionview moves footer down offscreen again.

i can't add row of height frame 2 reasons: first, expanded rect isn't on controllerview yet, second: if it's not new line, don't need space , it'll bounce down unnecessarily.

i guess schedule scroll check future time/runloop after insertion complete, hoping there might cleaner.

the answer turned out simple: add scroll check completion block of self.collectionview performbatchupdates:completion:


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -