Expand/collapse section in UITableView in iOS

前端 未结 17 1067
野的像风
野的像风 2020-11-22 08:49

Could somebody tell me the way to perform UITableView expandable/collapsible animations in sections of UITableView as below?

<

17条回答
  •  时光说笑
    2020-11-22 09:51

    Some sample code for animating an expand/collapse action using a table view section header is provided by Apple here: Table View Animations and Gestures

    The key to this approach is to implement - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section and return a custom UIView which includes a button (typically the same size as the header view itself). By subclassing UIView and using that for the header view (as this sample does), you can easily store additional data such as the section number.

提交回复
热议问题