次のコードを使用して配列がnilでない場合はボタンを非表示にしたいのですが、何らかの理由でボタンが機能していません。コードに間違いがありません。助けてください。ありがとうございます。
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString *title = nil;
HowtoUseButton = [[[CustomButton alloc] init] autorelease];
[HowtoUseButton addTarget:self action:@selector(openLink) forControlEvents:UIControlEventTouchDown];
HowtoUseButton.frame = CGRectMake(80.0, 140.0, 160.0, 70.0);
[self.view addSubview:HowtoUseButton];
if (document.count > 0){
HowtoUseButton.hidden = YES; // not working
title = Title_Doc;
}
else if (self.documentURLs.count == 0){
title = Title_No_Doc;
HowtoUseButton.hidden = NO;
}
return title;
}