iPhone UITableView with a header area

前端 未结 8 956
礼貌的吻别
礼貌的吻别 2020-12-23 20:26

I have a view that was created with all of the default UITableView stuff, but now I need to add a header area above where the UITableView is (so th

8条回答
  •  太阳男子
    2020-12-23 20:48

    When you add a UIView or one of its subclasses onto the UITableView using IB (just drag a UIView and drop it onto the UPPER part of UITableView of yours), it automatically adds that UIView component and makes it the "tableHeader" component.

    Each UITableView has one tableHeader and one tableFooter component reserved...

    This way the new view would be a part of the UITable, and scroll with it or appear/disappear or whatever you do to the table. You can change its hidden property if you need conditional behavior.

    On the other hand, if you want the header view stay put, as the table scrolls, then it is better to make the table smaller and put the header above it as suggested in other answers...

提交回复
热议问题