1 -(NSArray *)tgs
2 {
3 NSString *path = [[NSBundle mainBundle]pathForResource:@"tgs" ofType:@"plist"];
4 NSMutableArray *tgsArray = [NSMutableArray array];
5 NSArray *tgsDicts = [NSArray arrayWithContentsOfFile:path];
6 for (NSDictionary *dict in tgsDicts) {
7 tg *t = [tg tgWithDict:dict];
8 [tgsArray addObject:t];
9 }
10
11 _tgs = tgsArray;
12 return _tgs;
13 }
1 //#import <Foundation/Foundation.h>
2 //
3 //@interface tg : NSObject
4 //@property (nonatomic, copy) NSString *icon;
5 //@property (nonatomic, copy) NSString *title;
6 //@property (nonatomic, copy) NSString *price;
7 //@property (nonatomic, copy) NSString *buyCount;
8 //
9 //-(instancetype)initWithDict:(NSDictionary *)dict;
10 //+(instancetype)tgWithDict:(NSDictionary *)dict;
11 //@end
12
13 #import "tg.h"
14
15 @implementation tg
16 -(instancetype)initWithDict:(NSDictionary *)dict
17 {
18 if (self = [super init]) {
19 [self setValuesForKeysWithDictionary:dict];//KVC
20 }
21 return self;
22 }
23 +(instancetype)tgWithDict:(NSDictionary *)dict
24 {
25 return [[self alloc]initWithDict:dict];
26 }
27 @end