ios - UICollectionView: remove margin between cells -


i've collection view , display grid (2columns x n rows) vertical scrolling.

so implement uicollectionviewdelegateflowlayout methods:

func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize {     let collectionviewwidth: cgfloat  = collectionview.frame.size.width      let cellsize: cgfloat = collectionviewwidth / 2.0     return cgsizemake(cellsize, cellsize); }  func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, insetforsectionatindex section: int) -> uiedgeinsets {     return uiedgeinsetsmake(0.0, 0.0, 0.0, 0.0) }  func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, minimumlinespacingforsectionatindex section: int) -> cgfloat {    return 0.0 }  func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, minimuminteritemspacingforsectionatindex section: int) -> cgfloat {     return 0.0 } 

despite this, cells in collection view still separated white space.. i'm wrong?

per method names, giving minimum values, not absolute or maximum ones.

if want cells layouted without spaces, must give them width equal width of screen divided number of cells per row want display.

for example, on 320 pixels wide screen, fit 4 80x80 cells without empty spaces. if give them width of 60 pixels instead, end 20 pixels of empty space given equally between each cells.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -