出於性能考慮,通常重用UITableView的單元格。 有沒有辦法用TableView標題的視圖做同樣的事情? 我說的是與委託的方法返回的那些:可重複使用TableView標題視圖
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
我試圖做這似乎並不奏效以下預期:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
static NSString *CellIdentifier = @"Header";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
if (cell == nil) {
cell = [self getHeaderContentView: CellIdentifier];
}
return cell;
}
有沒有一種辦法重用標題'的意見?
作爲iOS 6中的你現在有`UITableViewHeaderFooterView`這使得使用reuseIdentifier的。 – h4xnoodle 2013-08-22 02:50:06
但是目前您不能在UI Builder中使用UITableViewHeaderFooterView。 – 2013-09-04 18:11:44