0

If i have a UIView, than i wish to set to the screen size for all devices to come . Than, the way i see it, there are 2 logical ways to do that .

  1. to set its margins to the edges of its super view , to be 0,that will keep its size to screen size.

  2. set its width and height , and Center it in the constrains section.

When i do the first one by setting "spacing to nearest neighbour" constrains to 0 , it still will not make it to be in the screen size - why is that not enough ? I must say that sometimes it does works ,but sometimes its just not, and i also have to Center the view constrains.

The other option, is also not clear to me . If you set a size for a view, like width or height, how can you know what number to choose ? you dont know what device is going to run it , and you dont want it to be a fixed value, but to change according to screen .

EDIT

I select a UIImageView, than , i open the small constrains window in storyboard, and i set the constrains of the "spacing to nearest neighbour" to be zero . thats it .

What happens is a very strange behaviour that i dont know if its related to the Xcode version . Sometimes, the image(actual image in the UIImageView), is stretched ,and change its content mode, sometimes, the view is not covering the whole screen, and he covers just 2/3 of its width . If i set its constrains to centre its x and y , it than cover the screen as accepted .

Curnelious
  • 1
  • 16
  • 76
  • 150
  • Please clear up what you mean by "it still will not make it to be screen size". Can you show some examples. What you have done sounds like it should be enough. – Fogmeister Sep 16 '14 at 14:18
  • see my edit please. i dont know if its the Xcode version, but the behaviour of it is very strange .bottom line, setting the constrains of a view to be 0 has to put it on the Center of the view? its not what happens with my collection view, he is just won't cover the screen, but part of it. – Curnelious Sep 16 '14 at 14:31
  • strange, i have read the answer trojanfoe posted here ,and when i do it in that way ,it works, but there is no explanation to why. the whole thing seems like a mystery thing. why if you tap the small button in storyboard and set constrains it does not work, but if you open the pin menu, and set the 4 sizes constrains, it does works ??? – Curnelious Sep 16 '14 at 14:43

0 Answers0