简体   繁体   中英

Need constraints for y position, height - Auto layout Storyboard

First let me tell that I have gone through multiple same kind of questions available in Stack Overflow but neither of them helped me.

So I created new question for discussing my problem.

I am beginner with iOS programming and with layout making in Storyboard so daily facing few problem in designing. With this problem, I already spent my 2 days but may be its really easy for an expert person to help me in this problem.

I was getting red warning in layout for need constraints for y position, height and any how I want to resolve this. Following image will make you more clear regarding this:

在此处输入图片说明

Specifically I was getting problem in video view and button below that regarding y position constraints.

在此处输入图片说明

So please suggest me, how to solve this problem? I was getting same problem multiple times when I was making layout so if I learn this solution then it will be big relief for me.

You need to set the VideoView Height constraint.

Steps:

  1. Select the VideoView.

  2. Click in "Add New Constraints" next to "Align" and after "Resolve Auto Layout Issues" option.

  3. Set the height constant you want.

  4. Check the height box.

  5. You also need set the Y position, because the VideoView don't know what is below and above. So, click the top constraint to make it look red, set the space that you need between your topView and the VideoView (in this case of my image example: 0) evidency of top constraint

  6. Click "Add 1 constraint"

You can give the constraints in the different ways as per your requirement:

1) Select your video view

2) Add new constraint and add the top constraint (Constraint between your Video view and top view, in your case the view with text surfa)

3) Select bottom constraint (if bottom buttons hight is fixed)

or

3) Select the height constraint (if you want to fix your video view height)

or

3) You can give the aspect ratio to video view (In this situation your view's height will be change as per the screen size)

Hope this will be helpful to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM