Я хотел использовать файл 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. Буду признателен за любую помощь