Is it possible to disable floating headers in UITableView with UITableViewStylePlain?

前端 未结 29 1057
走了就别回头了
走了就别回头了 2020-11-29 15:02

I\'m using a UITableView to layout content \'pages\'. I\'m using the headers of the table view to layout certain images etc. and I\'d prefer it if they didn\'t

29条回答
  •  北海茫月
    2020-11-29 15:21

    Change your TableView Style:

    self.tableview = [[UITableView alloc] initwithFrame:frame style:UITableViewStyleGrouped];
    

    As per apple documentation for UITableView:

    UITableViewStylePlain- A plain table view. Any section headers or footers are displayed as inline separators and float when the table view is scrolled.

    UITableViewStyleGrouped- A table view whose sections present distinct groups of rows. The section headers and footers do not float.

提交回复
热议问题