What is the problem? You didn't say if you're getting warnings, crashes, if it just fails to work, or what.
Edit: I took a look at your project. In your init method you were setting the center point, but not the width and height of the UIImageView. It doesn't change automatically when you change the image; the image gets squished instead. If you set the frame, your sprite appears OK:
Code:
@implementation Sprite
-(id) init {
if ((self = [super init])) {
self.image = [UIImage imageNamed:@"box.png"];
self.frame = CGRectMake(100, 100, 200, 200);
}
return self;
}
@end
You could also call [self initWithImage:] instead of [super init] and self.image = , if you want to use the dimensions of the image.
BTW it might be better to give you sprite class an instance variable to hold the UIImageView, instead of subclassing UIImageView. That way you won't get screwed if the definition of UIImageView changes, and you can better separate view-related stuff from model-related stuff later.