OGeek|极客世界-中国程序员成长平台

标题: IOS/ Storyboard/自动布局 : Center round button under horizontal bar [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:44
标题: IOS/ Storyboard/自动布局 : Center round button under horizontal bar

这应该非常简单,但不知何故,自动布局对我来说非常复杂。 我有一个水平条形按钮。我想在其下方居中放置一个圆形信息图标。自动布局不断尝试将圆形按钮拉伸(stretch)成椭圆形,并且没有将其从左到右居中,如下所示:

enter image description here

以上是以下应该有效但无效的约束的结果。

enter image description here

谁能告诉我要添加的正确约束来完成这个简单的任务。

谢谢。



Best Answer-推荐答案


如果图像正在被拉伸(stretch),则将其 contentMode 设置为 aspectFit 或 aspectFill。

完成后,您可以为图像添加约束,使其和登录按钮共享垂直中心。

关于IOS/ Storyboard/自动布局 : Center round button under horizontal bar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44187743/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4