开发者

Is there a way to determine what is the "top" section header of a UITableView?

Is there a way to determine what is the "top" section h开发者_高级运维eader of a UITableView?

For "top section header" I mean the section header that is sticky at the top of the UITableView bounds.


You can get the section number using this:

NSUInteger sectionNumber = [tableView indexPathForCell: [[[tableView visibleCells] objectAtIndex: 0] section]];

I hope that helps.


You'll want to use the -(UIView) viewForHeaderInSection method. This will allow you to use your own UI view as the header for the table view section.


If you mean the TABLE header (and the TABLE footer) - not the SECTION header/footer, then you access it through tableHeaderView a property of the UITableView

tableHeaderView Returns an accessory view that is displayed above the table.

@property(nonatomic, retain) UIView *tableHeaderView

If you want the SECTION header, then you need to create it by implementing the UITableViewDelegate method -tableView:viewForHeaderInSection:

tableView:viewForHeaderInSection: Asks the delegate for a view object to display in the header of the specified section of the table view.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜