0

Currently, I am working a app with UITableview. In each cell, there are 4 labels are showing data and value. However, the UI is working fine on iphone 5 simulator. When I use iphone 6 or 6s simulators, there is a space area at right hand side. I would like to have result that is 4 labels with equal space no matter it shows on iphone5 or iphone6. I know that I must use UI constaint to make it possible. However, I Google it but I cannot find similiar case. Please give me some hints or tutorial link to do so. Thank you.

enter image description here

Regards,

Tommy

Tommy Liu
  • 239
  • 4
  • 13
  • post your error log or problem image – Bhavin Bhadani Aug 13 '15 at 09:29
  • Try this [link](https://www.packtpub.com/books/content/evenly-spaced-views-auto-layout-ios) – Anusha Kottiyal Aug 13 '15 at 09:47
  • add leading and trailing constraint from labels to superview. – Mahesh Agrawal Aug 15 '15 at 02:09
  • Gentlemen - Thank you for your reply. The post had been updated. I had added the picture for your reference. I just want to get the result of iPhone 4.7 and 5.5 inch with like 4 inch screen. – Tommy Liu Aug 16 '15 at 16:19
  • You can use equalWidth constraints between your parent view and labels. Set multiplier to 0.2 or something that fit for you. Give leading and trailing constraints between them. It should work for you. – Candost Aug 16 '15 at 16:28
  • Dear all experts - I am newbie on it. Would you give me more hints or examples? I had tried to do, but I cannot get the equal width. Please help. – Tommy Liu Aug 18 '15 at 02:36
  • This video helps you. https://www.youtube.com/watch?v=WTMpJJ9Ofm8 && http://stackoverflow.com/questions/13075415/evenly-space-multiple-views-within-a-container-view – Javeed Aug 26 '15 at 12:07

1 Answers1

0

The way I find easiest to accomplish this is by creating a UIView for each of the UILabels. Then Make them all have equals widths and heights and add constraints for up, down, left and right.

Also dont forgot 3.5 inch as you still have to support that for iOS 8 and 9 :)

DairySeeker
  • 326
  • 3
  • 7