Bottom Margin in iPhone X using storyboard

大憨熊 提交于 2020-01-01 05:33:14

问题


Ok I have this case,

There is this screen I designed for iphone 8

As you can see here there is 8px green view that I pinned to the bottom of the superview by making a constrain of 0px between this view and top of bottom layout guide. and it works fine on all phone EXCEPT for the new iPhone X where this happens:

and thats not my intended behaviour. I want to to be as the other iPhones, pinned to the bottom with 0 margin.

Is there is a solution for that using the storyboard? Please post solutions using storyboard only. I know that I can do it programmatically. this should be easy on storyboard I guess.

Thank you


回答1:


1- Select your view in storyboard

2- Double click on bottom space constraint and select Superview for first item

3- Set constant value to 0




回答2:


You can achieve this

By Setting AutoResizing like this in storyboard

With AutoLayouts




回答3:


In storyboard select "View as: iPhone X" and pin the desired view to superview, not Bottom Layout Guide or Safe Area (in my example it's a full screen image view, your view would be pinned only to bottom):

Alternatively, if you are not in iPhone X view, you can pin bottom edge to superview by dragging with ctrl key and then when selecting from the list, press option key - more details in this answer: Autolayout: Add constraint to superview and not Top Layout Guide?



来源:https://stackoverflow.com/questions/46342023/bottom-margin-in-iphone-x-using-storyboard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!