在IOS水平中心约束问题? [英] Horizontal center constraint issue in ios?

查看:297
本文介绍了在IOS水平中心约束问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有学习的制约因素及放辛苦;自动布局在iOS.I已经使用的宽度和放大器;任何height.I有一个故事板的场景上我加入一个按钮和放大器;赋予了它一定高度和放大器; width.When我添加水平中心约束然后我得到的错误添加缺少的约束。 X code受力我按钮的宽度减少了对26个像素和放大器;还设置它的x&放大器; Ÿposition.Can有人知道为什么X $ C $ç问我减少宽度放大器;也改变原始x&放大器;年。

I am having hard time in learning constraints & auto-layout in iOS.I have used any-width & any height.I have a storyboard scene on which i am adding a button & has given it some height & width.When i add horizontal center constraint then i get error for adding missing constrains. Xcode force me to reduce the width of button up-to 26 pixels & also set it's x & y position.Can somebody tell why Xcode asking me to reduce width & also changing original x & y.

先谢谢了。

推荐答案

确定检查出的形象,这里的约束......

ok check out the image and constraints here...

您需要给宽度和高度的限制太....还需要给x和按钮的y位置。使屏幕了如指掌哪里开始绘制按钮排列多少宽度和高度

you need to give width and height constraints too....also need to give x and y position of button. so that screen knows the alignment from where to start drawing the button with how much width and height

这篇关于在IOS水平中心约束问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆