【问题标题】:uitableview section headings going under nav bar when translucent on iOS3 only仅在 iOS3 上半透明时,uitableview 部分标题位于导航栏下方
【发布时间】:2010-11-15 14:52:37
【问题描述】:

我的问题与 UITableView scrolling under the navigation bar 但我将其作为一个新问题发布,因为我有更多细节。

我在带有黑色 TRANSLUCENT 导航栏的页面上有一个全屏表格(带有部分)。这是在 UIViewController 中,因为我有一些视图覆盖在顶部,因此表格是通过编程方式创建的;

- (void)viewDidLoad {

  [super viewDidLoad];

   self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
   self.navigationController.navigationBar.tintColor = nil;
   self.navigationController.navigationBar.translucent = YES;

   tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewStylePlain];
   tableView.delegate = self;
   tableView.dataSource = self;
   [tableView setContentInset:UIEdgeInsetsMake(44,0,0,0)];

   [self.view addSubview:tableView];
   [tableView release];
}

我的问题是,虽然这在 iOS4 上完美运行 - 因为当您滚动时,部分标题会与半透明 tableview 的底部对接,但在 iOS3 上,标题会与状态栏的底部对接:(

如果我将 translucent 属性设置为 NO,并删除 contentInset,它在两个操作系统中的工作方式相同且正确。

除此之外,行为是正确的,我确实希望表格的内容在半透明导航栏后面向上滚动,但我也希望部分标题停止在导航栏下方,以便它们完全可见。

这对于 iOS3 和 iOS4 应该是一样的吗?有什么想法我可能做错了吗?

谢谢 罗杰

【问题讨论】:

  • 我实际上在 iOS 4.1 的导航栏后面也有标题视图。

标签: iphone uitableview


【解决方案1】:

尝试将tableview的frame frame设置为self.view.bounds

我的猜测是 [[UIScreen mainScreen] bounds] 是 480 像素高(带有状态栏)。

附言作为另一种选择,尝试设置 self.wantfullscreenlayout = NO;

【讨论】:

    猜你喜欢
    • 2014-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多