Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 10-24-2009, 01:39 PM   #12 (permalink)
tychop
N3RD
 
Join Date: Oct 2009
Posts: 201
Arrow

Has anybody got this working with an xib file?

I tried this but it crashes on me:

Code:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {	
	
	id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchedResultsController sections] 
													objectAtIndex:section];
	
	SpecialOffersTableViewSectionHeader *tableViewSectionHeader = 
		(SpecialOffersTableViewSectionHeader*)[[[NSBundle mainBundle] loadNibNamed:@"SpecialOffersTableViewSectionHeader" 
																			 owner:self 
																		   options:nil] lastObject];
	tableViewSectionHeader.sectionHeader.text = [sectionInfo name];
	self.tableView.tableHeaderView = tableViewSectionHeader;

	return tableViewSectionHeader;
}
Code:
@interface SpecialOffersTableViewSectionHeader : UIView {
    IBOutlet UILabel *sectionHeader;
}
@property (nonatomic, retain) IBOutlet UILabel *sectionHeader;
@end
Code:
#import "SpecialOffersTableViewSectionHeader.h"
@implementation SpecialOffersTableViewSectionHeader
@synthesize sectionHeader;
- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
- (void)dealloc {
    [super dealloc];
}
@end
The error I get in the console is:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<SpecialOffersTableViewController 0x3c0c8f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key sectionHeader.'
tychop is offline   Reply With Quote
 

» Advertisements
» Online Users: 294
17 members and 277 guests
ADY, antonwilliams, dacapo, dcool, HemiMG, jakerocheleau, leahov, MarkC, masc2279, michelle, morands, MozyMac, nobre84, sly24, smithdale87, thh022, vogueestylee
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,222
Posts: 380,720
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:16 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.