Kal
Kal copied to clipboard
KalViewController cannot be instantiated through xib
Your examples only show the viewcontroller being instantiated and pushed. If I try to place a KalViewController as a view inside of a navigation controller, I get the following exception when I try to access the view:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to find corresponding tile for date 0/0/0' *** Call stack at first throw: ( 0 CoreFoundation 0x02505919 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x026535de objc_exception_throw + 47 2 CoreFoundation 0x024be078 +[NSException raise:format:arguments:] + 136 3 Foundation 0x000d28cf -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116 ...
It looks like the we need a force the init call with today's date somehow. Can you document this?
Kal was never tested using Interface Builder because I don't use IB. If you'd like to figure out a fix, please go ahead. Thanks.
The function initWithCoder needs to be implemented for it to work with interface builder. I did:
- (id) initWithCoder:(NSCoder *)aDecoder { return [self initWithSelectedDate:[NSDate date]]; }
to work for a very basic implemention
Kelend's change is also needed if you want to invoke an instance of KalViewController inside a Storyboard file (iOS 5 SDK). Without this change, attempting to do this will result in the following:
*** Assertion failure in -[KalMonthView tileForDate:], /Users/jsmith/Developer/Kal/src/KalMonthView.m:84
Adding the following line to KalViewController.m solves the issue:
-(id)initWithCoder:(NSCoder *)aDecoder{return [self init];}