ios - Adjusting background color and spacing of a collection view background and cell spacing -


i have following code testing:

in viewdidload()

uicollectionviewflowlayout *layout = [[uicollectionviewflowlayout alloc] init];  self.collectionview = [[uicollectionview alloc] initwithframe:scrollview.frame collectionviewlayout:layout];   // these required [self.collectionview setdatasource:self]; [self.collectionview setdelegate:self];    //[self.collectionview.layer addbluegradient];  [self.collectionview registerclass:[uicollectionviewcell class] forcellwithreuseidentifier:@"cellidentifier"];  [self.view addsubview:self.collectionview];   }    - (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section { return 50; }  - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { uicollectionviewcell *cell=[collectionview dequeuereusablecellwithreuseidentifier:@"cellidentifier" forindexpath:indexpath]; cell.backgroundcolor = [uicolor redcolor]; return cell; }  - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout*)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath {     return cgsizemake(200, 200); } 

i have created category of calayer gradient called addbluegradient. how make ground of collection view (it's black or change uicolor)? how adjust spacing between cells?

 _collectionview.backgroundcolor = [uicolor clearcolor]; // setting collection background color  

and space

getting section spacing

– collectionview:layout:insetforsectionatindex: – collectionview:layout:minimumlinespacingforsectionatindex: – collectionview:layout:minimuminteritemspacingforsectionatindex: 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -