UITableView位于半透明导航栏下 [英] UITableView goes under translucent Navigation Bar

查看:123
本文介绍了UITableView位于半透明导航栏下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在IOS 7应用中使用透明导航栏。我的应用程序中有一个全屏图像。我也在该图像上有一个UITableView。当我使用下面的代码时,图像适合我想要的屏幕,但UITableView位于导航栏下。

I am trying to have a transparent navigation bar in IOS 7 app. There is a full screen image in my application. I am also having a UITableView over that image. When I use the code below, image fits the screen as I want but UITableView goes under navigation bar.

in viewDidLoad

我使用

self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
self.navigationController.view.backgroundColor = [UIColor clearColor];

当我改为 self.navigationController.navigationBar.translucent时,它还可以。 = NO; 但是我在导航栏上失去了透明度。

it is being ok when I change to self.navigationController.navigationBar.translucent = NO; but then I lose transparency at navigation bar.

推荐答案

你可以设置contentInsets你的tableView所以它最初位于导航栏下方,但会在它后面滚动(内容会重叠)

You could set the contentInsets of your tableView so it is initially below the navigation bar, but would scroll behind it (content would be overlapping)

self.tableView.contentInset = UIEdgeInsetsMake(44,0,0,0);

或者你可以抵消tableview的框架。然后滚动内容将在导航栏下方切断(这看起来也不会很好)

Or you could offset the frame of the tableview. Then the scrolling content would be cut off below the navigation bar (which wouldn't look good, too)

这篇关于UITableView位于半透明导航栏下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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