I do not know if this is stupid or not but I have been scratching my head over this for about an hour or two now.
I am getting a NSData object from NSUserDefaults then converting it to a UIImage. Now how do I set of the image of my CCSprite to my UIImage?
spriteWithFile doesn't work here since it requires a NSString. I am looking for an API that has a parameter of a UIImage. Is this possible?
Any ideas?
Edit1: How is this?
UIImage *image = [UIImage imageWithData:(NSData*)obj];
sprite = [CCSprite spriteWithCGImage:image.CGImage key:@"mainSprite"];
Try this one:
CCTexture2D *tex = [[[CCTexture2D alloc] initWithImage:uiImage] autorelease];
CCSprite *sprite = [CCSprite spriteWithTexture:tex];
uiImage is a UIImage object.