Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when adding a CCScale9Sprite to the a CCB #16

Open
tklee1975 opened this issue Nov 2, 2013 · 1 comment
Open

Exception when adding a CCScale9Sprite to the a CCB #16

tklee1975 opened this issue Nov 2, 2013 · 1 comment

Comments

@tklee1975
Copy link

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

@tklee1975
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant