• <legend id='DdJ1w'><style id='DdJ1w'><dir id='DdJ1w'><q id='DdJ1w'></q></dir></style></legend>

    <i id='DdJ1w'><tr id='DdJ1w'><dt id='DdJ1w'><q id='DdJ1w'><span id='DdJ1w'><b id='DdJ1w'><form id='DdJ1w'><ins id='DdJ1w'></ins><ul id='DdJ1w'></ul><sub id='DdJ1w'></sub></form><legend id='DdJ1w'></legend><bdo id='DdJ1w'><pre id='DdJ1w'><center id='DdJ1w'></center></pre></bdo></b><th id='DdJ1w'></th></span></q></dt></tr></i><div id='DdJ1w'><tfoot id='DdJ1w'></tfoot><dl id='DdJ1w'><fieldset id='DdJ1w'></fieldset></dl></div>
    1. <tfoot id='DdJ1w'></tfoot>
      • <bdo id='DdJ1w'></bdo><ul id='DdJ1w'></ul>

      <small id='DdJ1w'></small><noframes id='DdJ1w'>

        iOS7如何绘制透明的UIToolbar或UINavigationBar

        时间:2023-05-16

          <tfoot id='6YtAN'></tfoot>
        1. <i id='6YtAN'><tr id='6YtAN'><dt id='6YtAN'><q id='6YtAN'><span id='6YtAN'><b id='6YtAN'><form id='6YtAN'><ins id='6YtAN'></ins><ul id='6YtAN'></ul><sub id='6YtAN'></sub></form><legend id='6YtAN'></legend><bdo id='6YtAN'><pre id='6YtAN'><center id='6YtAN'></center></pre></bdo></b><th id='6YtAN'></th></span></q></dt></tr></i><div id='6YtAN'><tfoot id='6YtAN'></tfoot><dl id='6YtAN'><fieldset id='6YtAN'></fieldset></dl></div>
            <tbody id='6YtAN'></tbody>

            • <small id='6YtAN'></small><noframes id='6YtAN'>

              <legend id='6YtAN'><style id='6YtAN'><dir id='6YtAN'><q id='6YtAN'></q></dir></style></legend>

                  <bdo id='6YtAN'></bdo><ul id='6YtAN'></ul>
                  本文介绍了iOS7如何绘制透明的UIToolbar或UINavigationBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我想要一个完全透明的 UIToolbar 和/或 UINavigationBar.我已经尝试过为 iOS 5 前后建议的各种咒语,但似乎都不再奏效了.

                  I would like an entirely transparent UIToolbar and/or UINavigationBar. I have tried the various incantations suggested for pre- and post-iOS 5 but none seem to work any more.

                  这在 iOS 7 中如何实现?

                  How might this be accomplished in iOS 7?

                  推荐答案

                  Swift 3 (iOS 10)

                  透明UIToolbar

                  self.toolbar.setBackgroundImage(UIImage(),
                                                  forToolbarPosition: .any,
                                                  barMetrics: .default)
                  self.toolbar.setShadowImage(UIImage(), forToolbarPosition: .any)
                  

                  透明UINavigationBar

                  self.navigationBar.setBackgroundImage(UIImage(), for: .default)
                  self.navigationBar.shadowImage = UIImage()
                  self.navigationBar.isTranslucent = true
                  


                  斯威夫特 <3

                  透明UIToolbar

                  self.toolbar.setBackgroundImage(UIImage(),
                                                  forToolbarPosition: UIBarPosition.Any,
                                                  barMetrics: UIBarMetrics.Default)
                  self.toolbar.setShadowImage(UIImage(),
                                              forToolbarPosition: UIBarPosition.Any)
                  

                  透明UINavigationBar

                  self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
                  self.navigationBar.shadowImage = UIImage()
                  self.navigationBar.translucent = true
                  


                  目标-C

                  透明UIToolbar

                  [self.toolbar setBackgroundImage:[UIImage new]
                                forToolbarPosition:UIBarPositionAny
                                        barMetrics:UIBarMetricsDefault];
                  [self.toolbar setShadowImage:[UIImage new]
                            forToolbarPosition:UIBarPositionAny];
                  


                  透明UINavigationBar

                  [self.navigationBar setBackgroundImage:[UIImage new]
                                           forBarMetrics:UIBarMetricsDefault];
                  self.navigationBar.shadowImage = [UIImage new];
                  self.navigationBar.translucent = YES;
                  


                  讨论

                  将导航栏上的 translucent 设置为 YES 可以解决问题,因为在 UINavigationBar 文档.我将在这里报告相关片段:


                  Discussion

                  Setting translucent to YES on the navigation bar does the trick, due to a behavior discussed in the UINavigationBar documentation. I'll report here the relevant fragment:

                  如果您在具有不透明自定义背景图像的导航栏上将此属性设置为 YES,则导航栏将对图像应用小于 1.0 的系统不透明度.

                  If you set this property to YES on a navigation bar with an opaque custom background image, the navigation bar will apply a system opacity less than 1.0 to the image.


                  最终结果

                  这篇关于iOS7如何绘制透明的UIToolbar或UINavigationBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 Swift 从一个视图控制器导航到另一个视图控制器 下一篇:如何从 UINavigationController 弹出视图并在一次操作中将其替换为另一个视图?

                  相关文章

                    <bdo id='t3wqA'></bdo><ul id='t3wqA'></ul>

                  <small id='t3wqA'></small><noframes id='t3wqA'>

                • <tfoot id='t3wqA'></tfoot>
                  <legend id='t3wqA'><style id='t3wqA'><dir id='t3wqA'><q id='t3wqA'></q></dir></style></legend>
                • <i id='t3wqA'><tr id='t3wqA'><dt id='t3wqA'><q id='t3wqA'><span id='t3wqA'><b id='t3wqA'><form id='t3wqA'><ins id='t3wqA'></ins><ul id='t3wqA'></ul><sub id='t3wqA'></sub></form><legend id='t3wqA'></legend><bdo id='t3wqA'><pre id='t3wqA'><center id='t3wqA'></center></pre></bdo></b><th id='t3wqA'></th></span></q></dt></tr></i><div id='t3wqA'><tfoot id='t3wqA'></tfoot><dl id='t3wqA'><fieldset id='t3wqA'></fieldset></dl></div>