调用方法如下,但是我没有看到可见的接口错误!
// 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;
}
答案 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