views:

908

answers:

1

Okay, just for starters, I am very new to Objective-C, (C in general). I am not new to programming, and I've found the transition seamless so far, until now. I'm trying to implement a Sprite class I found online in order to develop a game on the iPhone, but I'm getting many errors. For example...

size = CGSizeMake([image size].width , [image size].height);

Where size is a CGSize object, synthesized and image is a UIImage object, synthesized. They are both declared in the Sprite.h file. The error I'm getting is "incompatible types in this assignment". Any help would be greatly appreciated. I feel as though the error is something simple, like an #include or something because every error has to do with a CoreGraphics function (CGRectMake, CGSizeMake, CGRectIntersectRect, etc.). I didn't know if I should post the entire class here, but I'll be happy to if requested to.

+3  A: 

When you say "size" is a CGSize object, I think you have a misunderstanding. CGSize is a regular C structure, and CGSizeMake returns a "CGSize" not a "CGSize *". My guess is that "size" is declared as "CGSize *" because you thought it was an object. Try removing the *.

NilObject
You are my hero sir. Thank you.
Kith