Использование файла XIB для настраиваемого заголовка раздела Tableview
Я хотел использовать файл xib для настройки раздела таблицы в xcode (цель C), и вот мои файлы:
SectionHeaderView.xib - это UIView с UILabel
SectionHeaderView.m
#import "SectionHeaderView.h"
@implementation SectionHeaderView
@synthesize sectionHeader;
@end
SectionHeaderView.h
#import <UIKit/UIKit.h>
@interface SectionHeaderView : UIView
{
IBOutlet UILabel *sectionHeader;
}
@property (nonatomic, strong) IBOutlet UILabel *sectionHeader;
@end
и в моем MasterViewController.m
#import "SectionHeaderView.h"
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
SectionHeaderView *header = [[[NSBundle mainBundle] loadNibNamed:@"SectionHeaderView" owner:self options:nil] objectAtIndex:0];
return header;
}
Пока все работает нормально, но как только я установил для пользовательского класса владельца файла XIB "SectionHeaderView" и подключите Метку к «sectionHeader» Я получу ошибку «NSUnknownKeyException». Я хотел соединить их, чтобы я мог изменить label.text с помощью следующего кода перед возвратом хедера:
header.sectionHeader.text = headerText;
Я использую раскадровку (xcode 4.5) для MasterViewController. Буду признателен за любую помощь