은 그냥 헤더에이 방법으로 사용자 정의보기를 반환 :
//Draws a custom view for the header instructions
-(UIView*)tableView:(UITableView*) tableView viewForHeaderInSection:(NSInteger)section;
{
if ([tableView numberOfRowsInSection:section] != 0) // To handle nil entries
{
UIView* headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 60)] autorelease];
// set up whatever view you want here. E.g.
UILabel* headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, headerView.frame.size.width - 20.0, headerView.frame.size.height)];
headerLabel.text = @"Tap items in the list to pin them.\nTap the Remix button to clear all unpinned items";
headerLabel.numberOfLines = 0;
headerLabel.font = [UIFont fontWithName:@"HelveticaNeueLTStd-Lt" size: 14];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.textColor = [UIColor colorWithRed:kColorRed green:kColorGreen blue:kColorBlue alpha:1];
headerLabel.userInteractionEnabled = NO;
headerLabel.textAlignment = UITextAlignmentCenter;
headerView.backgroundColor = [UIColor clearColor];
[headerView setTag:010];
[headerView setAlpha:1];
[headerView addSubview:headerLabel];
[headerLabel release];
return headerView;
}
else {
return nil; // again to handle nil tables. You should be nice and at least show an error label on the view.
}
}
을 그리고 이것은 다음과 같이 당신에게 뭔가를 제공합니다
정말 고마워요 당신의 도움을. 메소드를 구현했지만 프로그램이 다운되었습니다. ARC를 사용하고 있으므로 모든 자동 복구 기능을 제거했습니다. – xcoderookie
이후에 제대로 작동했는지 확인하십시오. 질문에 대한 해결책을 찾은 경우 체크 표시를 선택하십시오! – rinzler