1
我創建了一個UITableView,其中我調整了節頭的高度和背景。這一切都按預期工作,但其下方的單元(行)變小。幾乎看起來,節標題覆蓋了第一個單元格。 有沒有辦法解決這個問題?或者我應該問,如何解決這個問題?iPhone當增加UITableView節頭的高度時,它下面的單元高度會減小。如何避免?
我節頭的代碼:
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)];
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, tableView.bounds.size.width, 30)];
headerLabel.text = [self tableView:tableView titleForHeaderInSection:section];
headerLabel.font = [UIFont boldSystemFontOfSize:16];
[headerLabel setTextColor:[UIColor whiteColor]];
headerLabel.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"menuSectionBg.png"]];
[headerView addSubview:headerLabel];
return headerView;
}
工作完美!謝謝。 – iJar