[英]Remove space between UISearchBar and UINavigationBar (Swift)
Originally, I wanted the tint color of my search bar to be the same as the color of the navigation bar. 最初,我希望搜索栏的颜色与导航栏的颜色相同。 However, the navigation bar has a transparent effect, and this affects the saturation of the color.
但是,导航栏具有透明效果,这会影响颜色的饱和度。 So, I set the
transparent
property of the navigation bar to false. 因此,我将导航栏的
transparent
属性设置为false。 Now, they are the same color, but there is this large space between the two: 现在,它们是相同的颜色,但是两者之间有很大的空间:
How do I get rid of this space? 我如何摆脱这个空间?
EDIT: COULD THIS BE BECAUSE OF A UITABLEVIEW I HAVE THAT IS IN THIS VIEW? 编辑:可能是因为我在该视图中拥有一个UITableView吗? EDIT:
编辑:
If you are using autolayout, this looks like the searchbar has a top constraint of 0 to the top layout guide. 如果您使用的是自动布局,则搜索栏的顶部布局指南的顶部约束为0。 I don't know if this is a bug, but it causes the padding.
我不知道这是否是错误,但是会导致填充。
Make the top constraint 0 to the superview instead of the top layout guide or try a top constraint with a negative value (-20 - 44 = -64) to the top layout guide. 将顶部约束0设置为超级视图,而不是顶部布局指南,或者尝试对顶部布局指南使用负值(-20-44 = -64)的顶部约束。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.