Mac开发之项目中图片管理
来源:互联网 发布:352净化器怎么样 知乎 编辑:程序博客网 时间:2024/06/06 14:09
ImageManager.h
//
// ImageManager.h
// GrapeModule
//
//
#import <Foundation/Foundation.h>
@interface ImageManager : NSObject
@property (readonly) NSImage *imgPass;
@property (readonly) NSImage *imgFail;
@property (readonly) NSImage *imgTesting;
@property (readonly) NSImage *imgRebooting;
@property (readonly) NSImage *imgReady;
@property (readonly) NSImage *imgStopped;
@property (readonly) NSImage *imgFatalError;
@property (readonly) NSImage *imgBigPass;
@property (readonly) NSImage *imgBigFail;
@property (readonly) NSImage *imgLoopTest1;
@property (readonly) NSImage *imgLoopTest2;
@property (readonly) NSImage *imgCommError;
@property (readonly) NSImage *imgGreenLed ;
@property (readonly) NSImage *imgRedLed ;
@end
////////////////////////////////////////////////////////////////////////////////////////////////
//
// ImageManager.m
// GrapeModule
//
//
#import "ImageManager.h"
@implementation ImageManager
{
NSString* imageName;
}
@synthesize imgPass;
@synthesize imgFail;
@synthesize imgTesting;
@synthesize imgRebooting;
@synthesize imgReady;
@synthesize imgStopped;
@synthesize imgFatalError;
@synthesize imgBigPass;
@synthesize imgBigFail;
@synthesize imgLoopTest1;
@synthesize imgLoopTest2;
@synthesize imgCommError;
@synthesize imgGreenLed;
@synthesize imgRedLed;
- (id) init {
self = [super init];
if (self) {
do {
imageName = [[NSBundle mainBundle] pathForResource:@"pass" ofType:@"png"];
imgPass = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgPass == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"fail" ofType:@"png"];
imgFail = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgFail == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"testing" ofType:@"png"];
imgTesting = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgTesting == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"rebooting" ofType:@"png"];
imgRebooting = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgRebooting == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"ready" ofType:@"png"];
imgReady = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgReady == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"stopped" ofType:@"png"];
imgStopped = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgStopped == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"fatal_error" ofType:@"png"];
imgFatalError = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgFatalError == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"Pass1" ofType:@"png"];
imgBigPass = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgBigPass == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"Fail1" ofType:@"png"];
imgBigFail = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgBigFail == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"loopTest1" ofType:@"png"];
imgLoopTest1 = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgLoopTest1 == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"loopTest2" ofType:@"png"];
imgLoopTest2 = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgLoopTest2 == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"comm._error" ofType:@"png"];
imgCommError = [[NSImage alloc] initWithContentsOfFile:imageName];
if (imgCommError == nil) {
NSLog(@"Failed to load the following image:\n%@",imageName);
break;
}
imageName = [[NSBundle mainBundle] pathForResource:@"greenLed" ofType:@"png"] ;
imgGreenLed = [[NSImage alloc] initWithContentsOfFile:imageName] ;
if(imgGreenLed == nil){
NSLog(@"Fail to load the following image:\n%@",imageName);
break ;
}
imageName = [[NSBundle mainBundle] pathForResource:@"redLed" ofType:@"png"] ;
imgRedLed = [[NSImage alloc] initWithContentsOfFile:imageName] ;
if(imgRedLed == nil){
NSLog(@"Fail to load the following image:\n%@",imageName) ;
break ;
}
} while (0);
}
return self;
}
@end
- Mac开发之项目中图片管理
- Mac中使用svn进行项目管理
- 项目管理-Mac中使用svn
- 项目管理之开发计划
- 项目开发之风险管理
- 项目管理之项目开发计划
- 产品开发中项目与项目管理
- 项目管理之敏捷开发之道
- 软件项目管理之开发队伍建设篇
- [开发] 项目管理之 CVS & SVN 总结
- 项目管理之我见 程序开发步骤
- 软件开发中项目需求管理简述
- 敏捷项目管理实战之在敏捷开发中引入 Story 演示
- [置顶] 敏捷项目管理实战之在敏捷开发中引入 Story 演示
- Mac开发之如何设置NSButton高亮图片
- 【项目管理】项目开发管理
- 项目开发管理技术之项目版本控制
- mac 使用git管理项目
- Linux笔记
- VGA、QVGA、CIF、SXGA等视频格式尺寸
- 【C语言】C语言实现静态通讯录
- c++中函数重载的实现原理
- Jenkins启动
- Mac开发之项目中图片管理
- 【python】 python2.7.5 安装pip
- XYOJ 1007 连续多数求和
- easyui-combobox设置值
- 算法与数据结构知识点总结(1)
- Android开发 之 屏幕坐标获取想(x,y)
- R分类算法-KNN算法
- Andy's First Dictionary(P112) / UVA
- 润乾报表横竖连续打印问题