How do I add an extra separator to the top of a UITableView?

后端 未结 8 2127
面向向阳花
面向向阳花 2021-02-06 22:20

I have a view for the iPhone that is basically split in two, with an informational display in the top half, and a UITableView for selecting actions in the bottom half. The prob

8条回答
  •  渐次进展
    2021-02-06 22:36

    I just got hit with this same problem and realised that the separator at the top is only displayed whilst scrolling the table.

    What I then did was the following

    1. In Interface Builder go to "Scroll View Size"
    2. Set the Content Insets of Top to 1

    Alternatively in code you could do

    [tableView setContentInset:UIEdgeInsetsMake(1.0, 0.0, 0.0, 0.0)];
    

    NOTE: This no longer works for iOS7 as the separators are no longer shown at all.

提交回复
热议问题