ios - How to decrease the image width and height depend upon phone using constraints? -


i know there possibility increase , decrease width , height of ui objects.

enter image description here

1.took image example ,this collection view designed iphone 6.

2.while build project image occupy 2 in row.

3.while run iphone5,iphone4s 1 image can occupy row.

4.so know there way achieve image should place each phone should have 2 image inside collection cell.

5.i have tried set constraint collection cell later understood no possible.

you can set size of item in code using:

- (cgsize)collectionview:layout:sizeforitematindexpath: 

and

- (cgfloat)collectionview:layout:minimuminteritemspacingforsectionatindex: 

make sure calculate real width of each cell based on screen width: [[uiscreen mainscreen] bounds].size.width


Comments