Reputation: 16793
Could you please look at my code and tell me why I am doing wrong?
I am getting an error "No known class for selector method "imageWithImage: (UIImage)image...."
- (void)myMethod {
UIImage *iconImage=[UIImage imageNamed:@"male_small_0.png"];
// I am having problem in the following line
UIImage *iconImage2=[UIImage imageWithImage:iconImage scaledToSize:CGSizeMake(73.0, 73.0)];
}
-(UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize
{
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Upvotes: 0
Views: 210
Reputation: 53551
It should be [self imageWithImage:...]
not [UIImage imageWithImage...]
. The latter would imply that the method is a class method of UIImage
, but it seems to be an instance method of the class that contains myMethod
.
Upvotes: 2