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 .
to set its margins to the edges of its super view , to be 0,that will keep its size to screen size.
set its
width
andheight
, andCenter
it in theconstrains
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 .