ios - UICollectionView cell layout is out of the collection view's bounds -
i have uicollectionview lays cells out using flow layout. vertically scrolling.
it fills 320x480 screen , displays custom uicollectionviewcell 96*96 - size set in interface builder , delegate not implement methods set item size on per item basis.
there insets on left , right 10 px each , minimum spacing set 6px.
what happens therefore 3 cells per horizontal line.
<-10-><----96----><-6-><----96----><-6-><----96----><-10-> = 320.
the problem having lays 4 cells on 1 line! 4th cell off screen. lays 2 cells out on following line compensate. whole point of flow layout is line-breaking layout should not put off-screen!
i have attached picture:
please note on second row there fourth item off screen.
i have no idea causing it. cells dynamically filled data size constant. cells on other rows fitting fine there no reason why on rows should happen.
this error occurs @ different places each time collection view updated. ie. might happen @ row 2 once update happens might happen @ row 10 , on.
the collection view being updated timer. timer calls function processes data, , using dispatch_async (onto main queue) array containing backing data updated , [collectionview reloaddata] called. haven't updated collection view thread apart main thread. backing array updated on main queue , in function; not anywhere else.
please give me suggestions might going wrong.
thanks
i have fixed adding [_collectionviewflowlayout invalidatelayout]
in scrollviewdidscroll:
delegate methods.
Comments
Post a Comment