UITableViewの「トップ」セクションヘッダーを判別する方法はありますか?
「上部セクションヘッダー」とは、UITableView境界の上部に固定されているセクションヘッダーを意味します。
UITableViewの「トップ」セクションヘッダーを判別する方法はありますか?
「上部セクションヘッダー」とは、UITableView境界の上部に固定されているセクションヘッダーを意味します。
これを使用してセクション番号を取得できます。
NSUInteger sectionNumber = [tableView indexPathForCell: [[[tableView visibleCells] objectAtIndex: 0] section]];
それが役立つことを願っています。
SECTION ヘッダー/フッターではなく、TABLE ヘッダー (および TABLE フッター) を意味する場合tableHeaderView
は、UITableView
tableHeaderView Returns an accessory view that is displayed above the table.
@property(nonatomic, retain) UIView *tableHeaderView
SECTION ヘッダーが必要な場合は、UITableViewDelegate
メソッドを実装して作成する必要があります-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
-(UIView) viewForHeaderInSection メソッドを使用する必要があります。これにより、独自の UI ビューをテーブル ビュー セクションのヘッダーとして使用できます。