uicollectionview - Equal spacing for collectionview items in ios -
uicollectionview - Equal spacing for collectionview items in ios -
i using collection view controller display images in gallery. struck spacing. cant set equal spacing in collection view..
- (cgfloat)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout*)collectionviewlayout minimuminteritemspacingforsectionatindex:(nsinteger)section { homecoming 0; } - (cgfloat)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout*)collectionviewlayout minimumlinespacingforsectionatindex:(nsinteger)section { homecoming 0; } - (uiedgeinsets)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout insetforsectionatindex:(nsinteger)section { homecoming uiedgeinsetsmake(0, 0, 0, 0); } - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath { homecoming cgsizemake(106.0f, 106.0f); }
this code.. cell width 106 imageview width 104.0f gave 2 points spacing left side of image view got solution below image.
pls help me prepare problem...
to check how collection cells look, can seek in storyboard help of storyboard. first sake of checking, set static cells in collectionviewcontroller screen appears :
no can see cells , spacing between them. in case, cells appear improper spacing have shown above. open screen open, open size inspector fron interface builder. :
now can see options in size inspector window. can adjust size of each cell , spacing between them using min. spacing option. , equal spacing left , right sides, utilize section insets option. alter values there, alter reflected in controller view. can thought if want increase/decrease values.
hope helps.
ios uicollectionview
Comments
Post a Comment