これは超基本的な質問です。アプリで Matt Gemmell の MGImageUtilities のクラスを使用したいと考えています。クラスUIImage+ProportionalFill.h
をUIImage+ProportionalFill.m
プロジェクトに追加しました。メソッドを定義しますimageScaledToFitSize
。しかし、アプリを実行しようとすると、unrecognized selector sent to instance
エラーが発生します。明らかに、メソッドを実行したいクラスでメソッドを使用できるようにする必要がありますが、その方法がわかりません。#import UIImage+ProportionalFill.h
View Controllerの.hファイルと.mファイルの両方、および追加した.hファイルにあります
@interface UIImage (ProportionalFill)
- (void)imageScaledToFitSize;
@end
しかし、私はまだエラーが発生しています。私ができていない非常に基本的なことがあると思いますが、それが何であるかはわかりません。
あなたの考え?
更新: 私のプロジェクトには次のクラスが UIImage+ProportionalFill
あり, and '
ます.
。
- (UIImage *)imageScaledToFitSize:(CGSize)size;
にはGHViewController.m
、次のコードがあります。
UIImage *img = [self createImage];
UIImage *pic;
if (self.serviceType==SLServiceTypeFacebook)
{
CGSize size = CGSizeMake((404*320)/([[UIScreen mainScreen] bounds].size.height - 64), 404);
pic = [img imageScaledToFitSize:size];
}
それは私が呼んでいる唯一の場所ですimageScaledToFitSize
。