Wednesday, 15 June 2011

ios - UICollectionViewFlowLayout minimumInteritemSpacing doesn't work -



ios - UICollectionViewFlowLayout minimumInteritemSpacing doesn't work -

i've got 2 problems uicollectionview:

minimuminteritemspacing doesn't work it overflows horizontally on ios 6

i set layout this:

uicollectionviewflowlayout *layout = [[uicollectionviewflowlayout alloc] init]; layout.itemsize = cgsizemake(70.0f, 70.0f); layout.scrolldirection = uicollectionviewscrolldirectionvertical; layout.minimumlinespacing = 0.0f; layout.minimuminteritemspacing = 0.0f; _collectionview = [[uicollectionview alloc] initwithframe:cgrectzero collectionviewlayout:layout]; // set size of _collectionview in layoutsubviews: // _collectionview.frame = self.bounds; _collectionview.contentinset = uiedgeinsetsmake(8.0f, 8.0f, 8.0f, 8.0f);

the image shows result on ios 6 (on ios 7 there no overflow, spacing between columns still not zero)

i tried solution https://gist.github.com/oliverletterer/5583087, doesn't prepare in case.

from documentation minimuminteritemspacing property:

for horizontally scrolling grid, value represents minimum spacing between items in same column. spacing used compute how many items can fit in single line, after number of items determined, the actual spacing may perchance adjusted upward.

the flow layout evenly space cells across width, spacing of no smaller minimum set. if don't want spacing, you'll need implement own layout.

the ios 6 overflow issue i'm not sure about. seek dropping back upwards ios 6 ;)

ios objective-c cocoa-touch uicollectionview uicollectionviewlayout

No comments:

Post a Comment