6
32位ipad公司: UITableView節頭與64位iPad上的行重疊。能正常工作在32位
64位ipad公司:
下面的代碼:
- (float) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 40.0;
}
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 40)];
[headerView setBackgroundColor:[UIColor grayColor]];
UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 113, headerView.frame.size.height)];
nameLabel.font = [UIFont systemFontOfSize:14];
nameLabel.numberOfLines = 0;
nameLabel.textAlignment = NSTextAlignmentCenter;
nameLabel.text = @"Name";
[headerView addSubview:nameLabel];
nameLabel = [[UILabel alloc] init];
nameLabel.numberOfLines = 0;
nameLabel.font = [UIFont systemFontOfSize:14];
nameLabel.frame = CGRectMake(175, 0, 50, headerView.frame.size.height);
nameLabel.text = @"Risk Level";
[headerView addSubview:nameLabel];
nameLabel = [[UILabel alloc] init];
nameLabel.numberOfLines = 0;
nameLabel.font = [UIFont systemFontOfSize:14];
nameLabel.frame = CGRectMake(220, 0, 50, headerView.frame.size.height);
nameLabel.text = @"Code";
[headerView addSubview:nameLabel];
nameLabel = [[UILabel alloc] init];
nameLabel.numberOfLines = 0;
nameLabel.font = [UIFont systemFontOfSize:14];
nameLabel.frame = CGRectMake(280, 0, 60, headerView.frame.size.height);
nameLabel.text = @"Currency";
[headerView addSubview:nameLabel];
nameLabel = [[UILabel alloc] init];
nameLabel.numberOfLines = 0;
nameLabel.font = [UIFont systemFontOfSize:14];
nameLabel.frame = CGRectMake(420, 0, 100, headerView.frame.size.height);
nameLabel.text = @"Issuer";
[headerView addSubview:nameLabel];
return headerView;
}
@AshishAwaghad我用正確的方法,CGFloat的回報,但問題依然存在 – onmyway133