UITableView goes under translucent Navigation Bar

前端 未结 14 1073
一整个雨季
一整个雨季 2020-12-22 23:51

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

14条回答
  •  春和景丽
    2020-12-23 00:14

    Set the y-position of tableview to height of the navigation bar plus height of the status bar (let it be height)

    i.e,

      height = 64; // height of navigation bar = 44(In portait), height of status bar = 20
      tableView.frame = CGRectMake(tableView.frame.origin.x, height , tableView.frame.size.width, tableView.frame.size.height);
    

    If you are using autolayout just change the update the tableView top constraint instead of changing frame.

    and also change viewController automaticallyAdjustsScrollViewInsets to NO

    self.automaticallyAdjustsScrollViewInsets =  NO;
    

    If you are supporting different orientation update frame and contentInset to (52) because navigation bar height in landscape mode is 32.

    check this Sample

提交回复
热议问题