ヘッダー ラベルを作成し、それをインデントしてテーブル ビューの上に表示し、画面の左側にフラッシュしないようにしようとしています。次のコードを実装しました。これは、ヘッダー ラベルの外観を変更しますが、位置は変更しません。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,tableView.frame.size.width,30)];
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(10,0, headerView.frame.size.width, 30)];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.textColor = [UIColor whiteColor];
headerLabel.shadowColor = [UIColor grayColor];
headerLabel.shadowOffset = CGSizeMake(0.0, 1.0);
headerLabel.font = [UIFont boldSystemFontOfSize:18];
headerLabel.text = @"Header Label";
[headerView addSubview:headerLabel];
return headerLabel;
}
誰かが私が間違っていることを見ることができますか?
ありがとう