私は次のコードを持っています:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frameWidth, 24.0)];
[header setBackgroundColor:[UIColor grayColor]];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, self.view.frameWidth - 100, header.frameHeight)];
label.backgroundColor= [UIColor grayColor];
label.textColor = [UIColor whiteColor];
label.font = [UIFont boldSystemFontOfSize:17.0];
[header addSubview:label];
if (section == kEditInformationSection){
label.text = [AHConstants kEditInformation];
UIButton *editInformationButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frameWidth - 50, 0, 50, header.frameHeight)];
[editInformationButton setTag:1000];
[editInformationButton setBackgroundColor:[UIColor grayColor]];
[editInformationButton setTitle:[AHConstants kEdit] forState:UIControlStateNormal];
[editInformationButton addTarget:self action:@selector(switchToEditMode:) forControlEvents:UIControlEventTouchUpInside];
self.editInformationButton_ = editInformationButton;
[header addSubview:self.editInformationButton_];
self.tableHeaderView_ = header;
return self.tableHeaderView_;
} else if (section == kNotificationIntervalInfo){
label.text = [AHConstants kNotificationInterval];
return header;
}
return nil;
}
ボタンのアクションで、ボタンのタイトルを変更したかったので、次のようにしました。
[self.editInformationButton_ setTitle:[AHConstants kDone] forState:UIControlStateNormal];
なぜこれが機能しないのですか?