调用方法时没有可见接口

时间:2014-12-15 21:12:40

标签: ios uiimage core-graphics

调用方法如下,但是我没有看到可见的接口错误!

enter image description here

// My Header
#import <UIKit/UIKit.h>

@interface SectionViewController : UIViewController<UIScrollViewDelegate,UIGestureRecognizerDelegate>

@property (strong, nonatomic) IBOutlet UIImageView *imvPhoto;
+(UIImage*) drawImage:(UIImage*) fgImage
              inImage:(UIImage*) bgImage
              atPoint:(CGPoint)  point;

@end

// Implementation
+(UIImage*) drawImage:(UIImage*) fgImage
              inImage:(UIImage*) bgImage
              atPoint:(CGPoint)  point
{
    UIGraphicsBeginImageContextWithOptions(bgImage.size, FALSE, 0.0);
    [bgImage drawInRect:CGRectMake( 0, 0, bgImage.size.width, bgImage.size.height)];
    [fgImage drawInRect:CGRectMake(point.x, point.y, fgImage.size.width, fgImage.size.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return newImage;
}

2 个答案:

答案 0 :(得分:2)

你的语法错了。你错过了[和]。

使用:

imvPhoto.image = [YourClassName drawImage:imvPhoto.image inImage:anno.image atPoint:point];

而不是:

imvPhoto.image = drawImage:imvPhoto.image inImage:anno.image atPoint:point;

答案 1 :(得分:0)

好的,问题已修复

+(UIImage*) drawImage:(UIImage*) fgImage
              inImage:(UIImage*) bgImage
              atPoint:(CGPoint)  point

-(UIImage*) drawImage:(UIImage*) fgImage
              inImage:(UIImage*) bgImage
              atPoint:(CGPoint)  point