CCBReader
CCBReader copied to clipboard
Exception when adding a CCScale9Sprite to the a CCB
When putting a CCScale9Sprite on the CCLayer Interface file; Cocos2d version: cocos2d-iphone v2.1 CCBReader version: #define kCCBVersion 5
Exception raise at the following location: File: CCNode+CCBRelativePositioning.m
#ifdef __CC_PLATFORM_IOS
[self setValue:[NSValue valueWithCGSize:absSize] forKey:propertyName];
#else
[self setValue:[NSValue valueWithSize:NSSizeFromCGSize(absSize)] forKey:propertyName];
#endif
It will be fine if the "[self setValue]" removed or create a method "setValue" in CCScale9Sprite.m
Sorry that I don't know how to fix it yet!
Regards, ken
Solution for this problem: Add the following method to CCScale9Sprite.m
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
// NSLog(@"key=%@", key); // uncomment if want to debug
if([key isEqualToString:@"preferedSize"]) {
CGSize size = [value CGSizeValue];
self.preferredSize = size;
}
}
Note: the key is defined as "preferedSize" but not "preferredSize"; it may be something wrong in the exported CCB files.