0

シングルトンを作成しようとしていますが、エラーが発生し続け、何が間違っているのかわかりません。

ここに私の.hファイルがあります:

#import <Foundation/Foundation.h>

@interface ColorMaker : NSObject { 

}

+(ColorMaker* )sharedColorMaker;

- (UIColor* ) setColor : (float) red : (float) green : (float) blue; 

@end

これが.mです

#import "ColorMaker.h"

@implementation ColorMaker

+(ColorMaker *)sharedColorMaker { 

static ColorMaker* sharedColorMaker;

@synchronized(self) { 

    if (!sharedColorMaker)

        sharedColorMaker = [[ColorMaker alloc] init];

    return sharedColorMaker;

}

}

- (UIColor* ) setColor:(float)red :(float)green :(float)blue {

float newRed = red/255;
float newGreen = green/255;
float newBlue = blue/255;

UIColor* colorToReturn = [UIColor colorWithRed:newRed green:newGreen blue:newBlue alpha:1.0];

return colorToReturn;    
}

@end

ビューコントローラーでは、viewDidLoad:

- (void)viewDidUnload {
[super viewDidUnload];

ColorMaker* thisColorMaker = [ColorMaker sharedColorMaker];
}

「宣言されていない識別子 ColorMaker の使用」エラーが発生し続けます。

4

0 に答える 0