私はiphone開発に不慣れです。ヘッダーラベルにテキストを表示しました。テキストを中央に揃えたいと思います。私は次のコードを使用しています
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0,300.0,44.0)];
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor brownColor];
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:15];
headerLabel.frame = CGRectMake(0.0, 0.0, 500.0, 22.0);
headerLabel.text = @"Hello"; //
[customView addSubview:headerLabel];
return customView;
}
「こんにちは」はヘッダー ラベルの中央に表示されるはずです。助けてください。ありがとうございます。