0

My view is shown below:

enter image description here

I know I can achieve this by UICollectionView. I have used auto layout and my requirement is like : width of 2 cells in single row has same width and space between them are 10 px , and their height will be change dynamically. How to achieve this by auto layout? I have followed tutorial here : http://swiftiostutorials.com/tutorial-creating-custom-layouts-uicollectionview/ but its using frames not auto layout. How to this with auto layout? Suggest me

Pooja Shah
  • 977
  • 16
  • 45
  • What exactly are you trying to achieve with Auto Layout? Do you just need 2 equally sized views going across the page, or do you need a scrollable list? – Lucas Derraugh Aug 12 '15 at 05:59
  • @LucasDerraugh My cells size should be like this: Width : I specify 10 px space between to cells and the space after that left in that 2 cells should be wide with maintaining equal space Height: Should be dynamic but maintain aspect ratio of width – Pooja Shah Aug 12 '15 at 06:07
  • If you want a scrollable collection (one with cells) then you should accomplish this using the UICollectionView. I don't understand why you are trying to use Auto Layout if you are going to have multiple cells anyway? – Lucas Derraugh Aug 12 '15 at 06:09
  • @LucasDerraugh I am using UICollectionView, check in my question, I need to give auto layout to cell , and of course I have multiple cells . You are taking my question wrong, check again my question – Pooja Shah Aug 12 '15 at 06:11
  • Ah sorry, I did misunderstand you. Check this out: http://stackoverflow.com/questions/25009907/uicollectionviewcell-dynamic-height-with-autolayout – Lucas Derraugh Aug 12 '15 at 06:15
  • @LucasDerraugh the answer with up voted is using frame and in other answers the link given if different from what i needed, can you explain more how to do that or other link for similar kind of things? – Pooja Shah Aug 12 '15 at 06:19
  • The thing with UICollectionView is that you need to be able to give the size for the cell, the layout system doesn't affect the size of the cell after it is put on screen. I don't see how calculating the final size after layout has been performed won't work for your situation. Here's another question that may help: http://stackoverflow.com/questions/28161839/uicollectionview-dynamic-cell-height – Lucas Derraugh Aug 12 '15 at 06:28

0 Answers0