-1

I'm trying to achieve a very simple scenario using auto layout but without success. Please help me... I need 3 squares with a dynamic size(ex: on iPad, all of them should be scaled) on a table cell.

I have spend already some hours finding a solution.... This picture showing how the view should look like: enter image description here

Thanks

hackmajoris
  • 216
  • 2
  • 9
  • Just "a dynamic size"? If you don't tell us what size you want them to be how are we supposed to tell you how to tell autolayout? – dan Jul 31 '17 at 18:24
  • Hmm...I don't have a specific size, but let's have this one: height for 4 inch - 100, height for 12.9 inch - 200. The hight for table view cell is 300 on iPhone's, and 600 on iPad's – hackmajoris Jul 31 '17 at 18:37
  • @hackmajoris what about width? – agibson007 Jul 31 '17 at 22:28
  • How about a picture? – agibson007 Jul 31 '17 at 22:29
  • The width isn’t necessary because of Aspect Ratio constraint. It should be the same as height, because of square. – hackmajoris Aug 01 '17 at 03:11
  • Using a picture - isn’t a solution, because I have to use a custom view which represents a circle and it should be a square, in order to have a perfect circle. – hackmajoris Aug 01 '17 at 03:17

1 Answers1

1

You can do it with autoresizing tool which is appear in size inspector.

Step1: Place your views in which ever pattern you want.

Step2: Then select a view and click on size inspector.

Step3: Click to select inner arrows of autoresizing tools rectangle and deselect outer arrows (predefined selections).

Step4: Repeat same step for the remaining squares. Thats it. Verify below image which i have done. enter image description here

Do same for by placing table view in your storyboard, verify below image for which points autoresizing settings for table view clearly. enter image description here

Krishnarjun Banoth
  • 1,410
  • 1
  • 15
  • 30