简体   繁体   中英

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. But I also have background UIImageView with UIImage and it should be placed beneath navigation bar. So I tried to set it zPosition to -2 or -10 it doesn't work and it is seen through navigation bar somehow. 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. But it doesn't work. If i use UIView with some color instead of ImageView then it works correctly.

I've forgotten to add

clipToBounds = true

This solves the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM