In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to solve the transparency problem of navigationBar in ios development. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Transparency of navigationBar
If only the alpha of the navigationBar is set to 0, it is tantamount to hiding the navigationBar. As we all know, if the alpha of the parent view is set to 0, then all the child views will be transparent. Then the title of the corresponding navigationBar and the left and right buttons will disappear. This obviously does not achieve the desired effect.
(1) if you just want the navigationBar to be transparent, you can use the following methods for both buttons and captions:
[self.navigationController.navigationBar setBackgroundImage: [UIImage new] forBarMetrics:UIBarMetricsDefault]; / / set an empty background image for navigationBar to achieve transparency, and the caption buttons are all in the
If you are careful, you will find that there is a line on it like the following picture:
This requires us to do further processing, to remove the line, as follows:
Self.navigationController.navigationBar.shadowImage = [UIImage new]; / / actually this line is also controlled by image. Just set it to empty.
(2) if you want to change the effect from transparency to opacity according to the drop-down distance on the basis of transparency, then the one above seems inadequate, which requires us to adopt another method.
/ / navigationBar is a composite view, which is made up of many controls, so we can start from its interior [[self.navigationController.navigationBar subviews] objectAtIndex:0] .alpha = 0 / / here you can set alpha according to the offset of scrollView to achieve the effect of gradual transparency. This is the end of the article on "how to solve the problem of transparency of navigationBar in ios development". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.