-7

In my app, i need to put some boxes and make sure first two of them divided equally.

Navigation bar + status bar holds 64 point. Fixed height constraint of 60 point set to welcome box. Fixed height constraint of 145 point set to brown box. Tabbar holds 50 point.

Rest of the height which is 417 point should be divided into two. Green and Red boxes has its scrollviews in themselves. Scrollviews has layout constraint of same height, top, bottom, leading and trailing constraint for that of its superview. After layout is done, i inspected that red box has height of 208.66667 and green box has 208.3333. But each scroll views have height of 208.6667. So the scroll view at green box becomes vertically scrollable because its height(contentSize height) is bigger than that of its superview.

enter image description here

Ahmet Gulden
  • 2,063
  • 2
  • 15
  • 23
  • What is the question? If you're worried about the difference between 208.6- and 208.3- then that is less than a point and about 20% of a point from 208.5. No one will notice. For all practical purposes they are the same height. Actually, are you testing on an iPhone 6+? That would explain the division by three. – Fogmeister Dec 16 '14 at 17:05
  • I think you have some bottom vertical spacing constraint, which make this issue. Can you share nib or storyboard file to further investigate? – Vitalii Gozhenko Dec 16 '14 at 18:34
  • The tab bar height should be 49, so both height are 209, see https://www.dropbox.com/s/rwx18d1yvfhose0/Main.storyboard?dl=0 – gabbler Dec 19 '14 at 13:14
  • If you comment about your downvote, it would be appreciated – Ahmet Gulden Dec 23 '14 at 16:57

1 Answers1

0

You have some options.

  1. Resize the content of the scroll views to be 208px and ignore the left-over partial pixel.
  2. Disable scroll bars on the scroll views if you don't need them.
  3. Add a pixel to one of the other areas so that the red and green views can be equal heights.
  4. Size the views to the exact pixel dimension you want rather than just an "equal height" constraint.
picciano
  • 22,341
  • 9
  • 69
  • 82
  • Thank you for the answer. Since one code handles different devices i made it this way to handle different iPhones. I could not disable horizontal scroll but i could disable vertical scroll. – Ahmet Gulden Dec 24 '14 at 08:38