1

[self changeColor]; を使用して以下のメソッドを呼び出そうとしています。そして得る

「@MyClassViewController の目に見えるインターフェースは、セレクター「changeColor」を宣言していません

.h と .m の両方で次のように宣言しました。

@interface changeColor 

- (UIImage *) changeColor:(UIImage *)image;

@end

私が間違っていることは何ですか?助けてください

- - - - - - -コード - - - - - - -

- (UIImage *) changeColor:(UIImage *)image 

{
    UIGraphicsBeginImageContext(image.size);

    CGRect contextRect;
    contextRect.origin.x = 0.0f;
    contextRect.origin.y = 0.0f;
    contextRect.size = [image size];
    // Retrieve source image and begin image context
    CGSize itemImageSize = [image size];
    CGPoint itemImagePosition; 
    itemImagePosition.x = ceilf((contextRect.size.width - itemImageSize.width) / 2);
    itemImagePosition.y = ceilf((contextRect.size.height - itemImageSize.height) );

    UIGraphicsBeginImageContext(contextRect.size);

    CGContextRef c = UIGraphicsGetCurrentContext();
    // Setup shadow
    // Setup transparency layer and clip to mask
    CGContextBeginTransparencyLayer(c, NULL);
    CGContextScaleCTM(c, 1.0, -1.0);
    CGContextClipToMask(c, CGRectMake(itemImagePosition.x, -itemImagePosition.y, itemImageSize.width, -itemImageSize.height), [image CGImage]);

    CGContextSetRGBFillColor(c, 0, 0, 1, 1);

    NSLog(@"--------- METHOD DETECTED");//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST
    /*
    switch (row)

    {   
        case 0:
            CGContextSetRGBFillColor(c, 0, 0, 1, 1);
            break;

        default:
            CGContextSetRGBFillColor(c, 1, 0, 0., 1);
            break;
    }   
    */

    contextRect.size.height = -contextRect.size.height;
    contextRect.size.height -= 15;
    // Fill and end the transparency layer
    CGContextFillRect(c, contextRect);
    CGContextEndTransparencyLayer(c);

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}
4

1 に答える 1

3

問題は[self changeColor];です。 changeColorchangeColor:は2つの異なるものです。1つのパラメーターを取るものとして定義する場合は、そのように呼び出す必要があります。

于 2012-06-30T14:16:24.397 に答える