QQ好友列表数据模型封装
来源:互联网 发布:淘宝seo是干什么的 编辑:程序博客网 时间:2024/05/06 04:51
QQ好友中的信息较多,如果我们单独从plist 中直接取出数据 是可以解决问题
但是相当复杂,以为列表中分组 ,每组中还有不同信息
大致模型是 数组套数组 数组套字典
所以我们要封装数据模型
//// GPGroupController.h// 02-好友分组//#import <UIKit/UIKit.h>@interface GPGroupController : UIViewController@end
//// GPGroupController.m// 02-好友分组//#import "GPGroupController.h"#import "GPGroup.h"#import "NSArray+LocalPrint.h"@interface GPGroupController ()@property(nonatomic,strong)NSArray *groups;@end@implementation GPGroupController-(NSArray *)groups{ if (_groups == nil) { //1. NSString *path = [[NSBundle mainBundle]pathForResource:@"qq_group.plist" ofType:nil]; NSArray * dicts =[NSArray arrayWithContentsOfFile:path]; //2. NSMutableArray *objs = [NSMutableArray array]; for(NSDictionary *dic in dicts) { GPGroup *group = [GPGroup groupWthDict:dic]; [objs addObject:group]; } //3. _groups = objs; } return _groups;}- (void)viewDidLoad { [super viewDidLoad]; NSLog(@"%@",self.groups); // Do any additional setup after loading the view.}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}/*#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller.}*/@end
//// GPFriend.h// 02-好友分组#import <Foundation/Foundation.h>@interface GPFriend : NSObject@property(nonatomic,copy)NSString *icon;@property(nonatomic,copy)NSString *message;@property(nonatomic,copy)NSString *name;+(id)friendWithDict:(NSDictionary *)dict;-(id)initWithDict:(NSDictionary *)dict;@end
//// GPFriend.m// 02-好友分组//#import "GPFriend.h"@implementation GPFriend+(id)friendWithDict:(NSDictionary *)dict{ return [[self alloc]initWithDict:dict];}-(id)initWithDict:(NSDictionary *)dict{ if (self = [super init]) { [self setValuesForKeysWithDictionary:dict]; } return self;}- (NSString *)description{ return [NSString stringWithFormat:@"icon=%@,name=%@,message=%@", _icon,_name,_message];}@end
1 0
- QQ好友列表数据模型封装
- 转移QQ好友列表
- 实现QQ 好友列表
- 仿QQ好友列表
- QQ好友列表
- qq好友列表 模拟
- 山寨QQ好友列表
- 获取QQ好友列表
- 练习:QQ 好友列表
- QQ好友列表展示
- 获取QQ好友共同好友列表信息
- 模仿QQ农场好友列表
- 列表嵌套(QQ好友)
- Qt制作QQ好友列表
- Qt制作QQ好友列表
- ExpandableListView仿QQ好友列表
- ExpandableListView仿QQ好友列表
- android 实现QQ好友列表
- leetcode 133: Clone Graph
- Java跨平台开发神器之JNI
- Spring AOP
- LeetCode Regular Expression Matching
- 2.8 寻找符合条件的数
- QQ好友列表数据模型封装
- 8.17总结
- Django+redis 实现登录
- template < typename T >
- HDU 3970 Harmonious Set 容斥欧拉函数
- 大流量高并发性能优化
- Example of MPI_Type_struct
- OC协议protocol详解
- wince系统中对nand坏块的修正