How to change the status bar bgcolor for UITableView with hidden nav bar?

半城伤御伤魂 提交于 2019-12-13 19:15:39

问题


The UITableView is inside NavigationController, but navigation bar hidden by this line:

[[self navigationController] setNavigationBarHidden:YES animated:YES];

What I have:

What I want:

What I've tried:

  • How to change Status Bar text color in iOS 7: tried the 1 & 2nd steps, didn't work. (the 3rd step would make all text in status bar white)

  • modify the frame of the 1st cell in:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath:
    
    // for the 1st cell, move frame up to cover status bar
    if (indexPath.row == 0) {
        CGRect frame = cell.frame;
    //  frame.origin.y -= 50;
        frame.size.height += 50;
        cell.frame = frame;
    }
    

回答1:


Turned out that I had to set the background color of the whole UITableView, simple as that.




回答2:


Set the tableview background color to the redcolor then status bar will be shown in redcolor



来源:https://stackoverflow.com/questions/26332638/how-to-change-the-status-bar-bgcolor-for-uitableview-with-hidden-nav-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!