[英]iOS > Changing Navigation Bar zPosition and UIImageView
I want to place image over navigation bar, but partially on it an partially on content view.我想将图像放在导航栏上,但部分放在内容视图上。 So I set UINavigationBar.layer.zPostion to -1 and it works perfectly well especially on iPhones.
所以我将 UINavigationBar.layer.zPostion 设置为 -1,它运行得非常好,尤其是在 iPhone 上。 But I also have background UIImageView with UIImage and it should be placed beneath navigation bar.
但我也有背景 UIImageView 和 UIImage ,它应该放在导航栏下方。 So I tried to set it zPosition to -2 or -10 it doesn't work and it is seen through navigation bar somehow.
所以我尝试将它的 zPosition 设置为 -2 或 -10 它不起作用,并且它以某种方式通过导航栏看到。 I even tried to place another UIView above Background UIImageView and beneath NavigationBar to be able to mask/hide this image and have colour like navigation bar.
我什至尝试在背景 UIImageView 上方和 NavigationBar 下方放置另一个 UIView,以便能够屏蔽/隐藏此图像并具有类似导航栏的颜色。 But it doesn't work.
但它不起作用。 If i use UIView with some color instead of ImageView then it works correctly.
如果我使用带有某种颜色的 UIView 而不是 ImageView,那么它可以正常工作。
I've forgotten to add我忘记添加了
clipToBounds = true
This solves the problem这解决了问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.