0

你能看看我的代码并告诉我为什么我做错了吗?

我收到一个错误"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;

}
4

1 回答 1

2

应该[self imageWithImage:...]不是[UIImage imageWithImage...]。后者意味着该方法是 的类方法UIImage,但它似乎是包含 的类的实例方法myMethod

于 2013-05-10T16:12:45.813 回答