简体   繁体   English

如何在自动布局ios中将视图的底部边缘和顶部边缘与另一个视图冲突?

[英]How to contraint the bottom edge and top edge of a view to another view in auto layout ios?

I am trying to place a circular imageview on top of another imageview something like in the picture. 我试图将圆形imageview放在另一个imageview的顶部,如图所示。 Does anyone know how i can achieve it. 有谁知道我怎么能做到这一点。

在imageview顶部的圆形imageview

In storyboard, you can do it by setting circular image align bottom to image view with half size of your circular image. 在情节提要中,您可以通过将圆形图像设置为底部对齐以使图像视图的尺寸为圆形图像的一半来实现此目的。 In my case circular image's height is 100 so, it's half is 50. Please see following image for detail. 在我的情况下,圆形图像的高度是100,所以一半是50。有关详细信息,请参见下图。

在此处输入图片说明

Hope this help! 希望对您有所帮助!

you should give center vertical constraint and then open constraint property and change first item or second item (as per your requirement) center y to top option Like 您应该给定中心垂直约束,然后打开约束属性并将第一项或第二项(根据您的要求)更改为中心y到顶部选项

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获得视图的底部边缘? - How to get bottom edge of the view? 自动布局:以编程方式将视图顶部固定到另一个视图的底部 - Auto layout: Pin top of view to bottom of another view programatically 在View(iOS)的底部边缘触摸不注册 - Touch not registering at bottom edge of View (iOS) iOS:使用固定的长宽比将视图约束到后缘或下边缘 - iOS: Constraining View with fixed aspect ratio to trailing edge OR bottom edge iOS自动布局:将一个按钮的边缘与另一个按钮的中心对齐? - iOS Auto Layout: Align the edge of one button to the center of another button? 是否无法约束标签的基线以匹配另一个视图的底边? - Is there no way to constrain the baseline of a label to match the bottom edge of another view? ios自动布局另一个视图(分层)的边缘上的叠加视图 - ios autolayout overlay view on edge of another view (layering), programmatically 如何将一个视图的顶部设置为另一个视图的底部 - How to set top of a view to bottom of another view 如何在集合视图单元的内部底部边缘添加阴影? 迅捷3 - How to add a shadow to the inside bottom edge of a collection view cell? swift 3 NSLayoutConstraint可以将视图固定到superview的下边缘 - NSLayoutConstraint that would pin a view to the bottom edge of a superview
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM