ios - The relation between UICollectionViewFlowLayout height and UICollecionView height -


i having problem seems uicollectionview thinks screen smaller (ipad air) , , fail load next cells in time ,and load them in late-cause "holes". have 2 columns,dynamic cell height,and subclassed layout constant vertical spacing.

i see now, thing solves problem me = let uicollectionview load more cells can scroll down , not see blank spaces, set height of collectionview higher screen size . now, cells loaded in time when scrolling down. , when scroll , same effect of empty spaces . empty means half screen empty ,and when continue scrolling ,he loads these cells in late.

i can't seem solve issue while, think might wrong setting relationship between layout , colleciontview content sizes .

here how set them :

 //collection view     topalignedcollectionviewflowlayout *layout=[[topalignedcollectionviewflowlayout alloc] init];      cgrect  size=cgrectmake( ([uiscreen mainscreen].bounds.size.width-collectionwidth)/2,                             upperlinemargin, collectionwidth, (6.*[uiscreen mainscreen].bounds.size.height )); //seting *6 soves problem.       self.gridview=[[uicollectionview alloc] initwithframe:size collectionviewlayout:layout];     [self.gridview registerclass:[gridcell class] forcellwithreuseidentifier:@"cell"];      //[ layout setitemsize:cgsizemake(collectionwidth, [uiscreen mainscreen].bounds.size.height )]; 

this issue happens after trying subclass layout equal spacing between rows. in situation don't have go, , can't use collection bug, because temporary blank spaces not looks .

- (uicollectionviewlayoutattributes *)layoutattributesforitematindexpath:(nsindexpath *)indexpath {     uicollectionviewlayoutattributes* currentitemattributes = [super layoutattributesforitematindexpath:indexpath];       if (indexpath.item < numcolumns)     {         cgrect f = currentitemattributes.frame;         f.origin.y = 0;         currentitemattributes.frame = f;         return currentitemattributes;     }       nsindexpath* ipprev = [nsindexpath indexpathforitem:indexpath.item-numcolumns insection:indexpath.section];     cgrect fprev = [self layoutattributesforitematindexpath:ipprev].frame;     cgfloat ypointnew = fprev.origin.y + fprev.size.height + 10;     cgrect f = currentitemattributes.frame;     f.origin.y = ypointnew;     currentitemattributes.frame = f;     return currentitemattributes; } 


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -