//

//  该类管理设备的图标

 

#import <Foundation/Foundation.h>

 

typedefenum {

    diandeng=0,

//    chazuoSel,

    

    chazuo,

//    diandengSel,

    

    dianshi,

//    dianshiSel,

    

    dianfanbao,

//    dianfanbaoSel,

    

    gongfang,

//    gongfangSel,

    

    fenshan,

//    fenshanSel,

    

    kongtiao,

//    kongtiaoSel,

}ButtonCenterIco;

 

@interface ImageDataManage : NSObject

 

+(ImageDataManage *)instance;

//通过设备类型返回相应的图标

-(NSString *)getButtonCenterIco:(ButtonCenterIco)icoType isHighlight:(BOOL)isHighlight;

-(NSMutableDictionary *)imageDic;

 

@end

 

//

//  ImageDataManage.m

//  SmartHomeWIFI

//

//  Created by 深圳市 秀软科技有限公司 on 14-1-24.

//  Copyright (c) 2014 huhuaxiang. All rights reserved.

//

 

#import "ImageDataManage.h"

 

static ImageDataManage *imageDataManage=nil;

 

@implementation ImageDataManage

 

-(id)init

{

    if(self=[superinit])

    {

        

    }

    returnself;

}

 

+(ImageDataManage *)instance

{

    if(!imageDataManage)

    {

        imageDataManage=[[ImageDataManagealloc]init];

    }

    returnimageDataManage;

}

 

-(NSString *)getButtonCenterIco:(ButtonCenterIco)icoType isHighlight:(BOOL)isHighlight

{

    NSString *imageName=[[self imageDic] objectForKey:[NSNumber numberWithInt:icoType]];

    NSRange range=[imageName rangeOfString:@"."options:NSBackwardsSearch];

 

    if(isHighlight)//高亮状态_sel

    {

        NSString *s=[imageName substringWithRange:NSMakeRange(0, range.location)];

        NSString *e=[imageName substringWithRange:NSMakeRange(range.location+1, imageName.length-(range.location+1))];

        imageName=[NSString stringWithFormat:@"%@_sel.%@",s,e];

    }

    return imageName;

}

-(NSMutableDictionary *)imageDic

{

    

    NSMutableDictionary *dic=[[NSMutableDictionaryalloc]initWithCapacity:5];

     [dic setObject:@"buttonCenterIco_diandeng.png"forKey:[NSNumbernumberWithInt:diandeng]];  //1

//    [dic setObject:@"buttonCenterIco_chazuo_sel.png" forKey:[NSNumber numberWithInt:chazuoSel]];

    

     [dic setObject:@"buttonCenterIco_chazuo.png"forKey:[NSNumbernumberWithInt:chazuo]];     //2

//    [dic setObject:@"buttonCenterIco_diandeng_sel.png" forKey:[NSNumber numberWithInt:diandengSel]];

    

    [dic setObject:@"buttonCenterIco_dianshi.png"forKey:[NSNumbernumberWithInt:dianshi]];    //3

//    [dic setObject:@"buttonCenterIco_dianshi_sel.png" forKey:[NSNumber numberWithInt:dianshiSel]];

    

    [dic setObject:@"buttonCenterIco_dianfanbao.png"forKey:[NSNumbernumberWithInt:dianfanbao]];    //4

//    [dic setObject:@"buttonCenterIco_dianfanbao_sel.png" forKey:[NSNumber numberWithInt:dianfanbaoSel]];

    

    [dic setObject:@"buttonCenterIco_gongfang.png"forKey:[NSNumbernumberWithInt:gongfang]];     //5

//    [dic setObject:@"buttonCenterIco_gongfang_sel.png" forKey:[NSNumber numberWithInt:gongfangSel]];

    

    [dic setObject:@"buttonCenterIco_fenshan.png"forKey:[NSNumbernumberWithInt:fenshan]];    //6

//    [dic setObject:@"buttonCenterIco_fenshan_sel.png" forKey:[NSNumber numberWithInt:fenshanSel]];

    

    [dic setObject:@"buttonCenterIco_kongtiao.png"forKey:[NSNumbernumberWithInt:kongtiao]];    //7

//    [dic setObject:@"buttonCenterIco_kongtiao_sel.png" forKey:[NSNumber numberWithInt:kongtiaoSel]];

    

    return dic;

}

@end

 

posted on 2014-03-16 21:36  阿里海瑟要  阅读(139)  评论(0编辑  收藏  举报