设置状态栏隐藏会弄乱我的导航栏背景图像大小 [英] Setting status bar hidden is messing with my navigation bar background image size

查看:28
本文介绍了设置状态栏隐藏会弄乱我的导航栏背景图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我只想将一个视图控制器状态 bat 更改为隐藏.

In my app I want to change only one view controller status bat to hidden.

所以在视图中加载方法我添加了这个:

So in the view did load method I added this:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

网上的所有指南都这么说.

Thats what allot of the guides online said to do.

现在,这个视图控制器是一个表格视图,我已经将它的导航栏背景图像设置为自定义的,在我隐藏状态栏之前它看起来像这样:

Now, this view controller is a table view, and I have set its nav bar background image to something custom, it looks like this before Im hiding the status bar:

在我添加隐藏方法之后:

And after I added the hidden method:

所以你可以看到它剪切了 bg 图像的一部分(带有绿线).

So you can see it cuts part of the bg image (with the green line).

我的导航栏 bg 图像大小是 640 × 128 我把它放在 xcode 的 X2 上,所以这应该在隐藏状态栏后覆盖整个导航栏......不是它吗?

my nav bar bg image size is 640 × 128 and I put it on X2 in xcode, so this should cover the whole nav bar after hiding the status bar.....isn't it?

请帮忙,

谢谢!

推荐答案

状态栏的高度为 20 像素,因此您需要以编程方式增加 UINavigation 控制器高度的大小,仅针对需要较小背景的视图控制器该视图控制器的图像.

The status bar is 20 pixel in hight so either you need to programmatically increase the size on the UINavigation controller hight just for that view controller of you need a smaller background image for that view controller.

这篇关于设置状态栏隐藏会弄乱我的导航栏背景图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆