ios - How can I get my UICollectionView to be the same width as my device when using Auto Layout? -
i created uicollectionview
in storyboard editor , added (custom) viewcontroller
. every view controller in storyboard, says size 600x600 , uicollectionview
, takes whole view, 600x600.
this not correct though, writing iphone app , real dimensions should 320x568!
because of this, when add items collection, placed off right side of screen. example, first add cell image in of size 160x213. left justified , takes left half of screen. when add next image, there huge gap , appears on left side, partly cut off. third image expect appear below first, doesn't appear @ all. believe off right side of screen. implies size of uicollectionview
600x600 , not 320x568.
i should mention i've tried think of fix this. example:
i tried adjusting size of collection view:
self.photocollection.frame = cgrectmake(0, 0, 320, 568);
i tried unchecking "use size classes" in storyboard editor.
it seems work if uncheck "use auto layout" use auto layout. how work?
- you can set "simulated metrics" of view in storyboard below. personally, prefer using 3.5/4-inch construct layout, auto layout, need add constraints elements , ios automatically support 4.7 , 5 inch screen size.
- i think should google "auto layout" tutorials, , don't think hard pick :d. instance, if want set collection view frame equal view frame. can this
feel free ask follow question if have any, cheers!