【问题标题】:How to set a UINavigation size to fit the background image size?如何设置 UINavigation 大小以适合背景图像大小?
【发布时间】:2015-06-04 02:30:47
【问题描述】:

我已将我的UINavigationBar 背景图像设置为某个图像,如下所示:

UINavigationBar *navBar = self.navigationController.navigationBar;
UIImage *image = [UIImage imageNamed:@"Menubar.png"];
[navBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

但我无法真正看到整个图像,因为它比 UINavigationBar 上的默认尺寸大。

请注意两点:

  1. 如何设置UINavigation 大小以适应背景图片大小?
  2. 我不想在背景中看到电池和时间栏,所以我的图像会覆盖它。

【问题讨论】:

    标签: ios objective-c uinavigationcontroller uinavigationbar


    【解决方案1】:
    1. 无法设置 UINavigation 大小(查看this question),您必须改为适合背景图像
    2. 无法覆盖状态栏,但您可以轻松隐藏它。见例子here

    【讨论】:

      【解决方案2】:

      您可以使用 info.plist 文件轻松删除状态栏

      只需 addRow 并写入“状态栏最初隐藏”并设置值“YES”

      结束对导航栏的检查 iOS. How to change UINavigationBar height and change frames of the others subviews at once?

      【讨论】:

        猜你喜欢
        • 2013-02-25
        • 2015-11-13
        • 2015-07-30
        • 2014-06-05
        • 1970-01-01
        • 1970-01-01
        • 2018-01-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多