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

QQ好友列表数据模型封装的更多相关文章

  1. iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(一)

    iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(一) 一.项目结构和plist文件 二.实现代码 1.说明: 主控制器直接继承UITableViewController // ...

  2. ExpandableListView仿QQ好友列表

    本例中,对ExpandableListView中的数据进行了封装,分为两个JavaBean,一个为Group类表示组信息,一个Child类表示该组下子列表信息: Group: public class ...

  3. (二十七)QQ好友列表的实现

    QQ好友列表通过plist读取,plist的结构为一组字典,每个字典内有本组的信息和另外一组字典代表好友. 要读取plist,选择合适的数据结构,例如NSArray,然后调用initWithConte ...

  4. 基于Qt的相似QQ好友列表抽屉效果的实现

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/shuideyidi/article/details/30619167     前段时间在忙毕业设计, ...

  5. Windows UIA自动化测试框架学习--获取qq好友列表

    前段时间应公司要求开发一款针对现有WPF程序的自动化测试工具,在网上查资料找了一段时间,发现用来做自动化测试的框架还是比较多的,比如python的两个模块pywinauto和uiautomation, ...

  6. [iOS基础控件 - 6.9.3] QQ好友列表Demo TableView

    A.需求 1.使用plist数据,展示类似QQ好友列表的分组.组内成员显示缩进功能 2.组名使用Header,展示箭头图标.组名.组内人数和上线人数 3.点击组名,伸展.缩回好友组   code so ...

  7. 仿QQ好友列表界面的实现

    TableView有2种style:UITableViewStylePlain 和 UITableViewStyleGrouped. 但是QQ好友列表的tableView给人的感觉似乎是2个style ...

  8. android 实现QQ好友列表

    在某些Android开发群里,看到有些新手问怎么实现QQ好友列表,其实网上一搜挺多的.接触Android,也才一年的时间,大部分时间花在工作上(解bug...),界面上开发很少参与.自己维护的系统应用 ...

  9. swift 实现QQ好友列表功能

    最近项目中有类似QQ好友列表功能,整理了一下,话不多说,直接上代码 import UIKit class QQFriend: NSObject { var name: String? var intr ...

随机推荐

  1. PCB 周期计算采用 SQL 函数调用.net Dll 标量函数 实现

    PCB 周期计算采用 SQL函数调用.net Dll实现 (实现代码重用目的) 玩过SQL SERVER数据库经常经需要写存储过程,函数之类的,当业务逻辑过于复杂,用SQL去写简直是恶梦, 这里以PC ...

  2. Pet(dfs)

    http://acm.hdu.edu.cn/showproblem.php?pid=4707 题意:判断距离大于D的点有多少个. 思路: 邻接表建图,dfs每一个点,记录步数. #include &l ...

  3. 1961 躲避大龙(dfs)

    1961 躲避大龙  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond     题目描述 Description 你早上起来,慢悠悠地来到学校门口,发现已经是 ...

  4. 深入理解Redis——(总纲)

    前言 Redis这个东西,我来来回回的也搞了好几遍,之前更偏向于实战,很多时候只知其然而不知其所以然,最近借阅了一本<深入理解Redis>,就系统的整理一下. 为何选择Redis 开源免费 ...

  5. B - Sleuth

    Problem description Vasya plays the sleuth with his friends. The rules of the game are as follows: t ...

  6. mac下idea卡顿问题解决

    idea在加载相对来说比较大的系统时,经常性出现卡顿,就是直接卡死,以至于写起代码特别难受. 最后找到的解决方案是修改idea.vmoptions中的内存大小 执行 find / -name idea ...

  7. jboss-as-7.1.1.Final配置Jndi数据源(以mysql为例)

    1.获取mysql驱动,可以从mysql官方网站下载: http://dev.mysql.com/downloads/connector/j/ 2.进入jboss-as-7安装目录下的modules目 ...

  8. (转载)实例详解Android快速开发工具类总结

    实例详解Android快速开发工具类总结 作者:LiJinlun 字体:[增加 减小] 类型:转载 时间:2016-01-24我要评论 这篇文章主要介绍了实例详解Android快速开发工具类总结的相关 ...

  9. Microsoft Azure Storage Explorer

    上周主管说,要把每次开过的发票,要下载成Pdf的文件,然后就实时的将这些发票存到云上面去. 就是这个Microsoft Azure ,微软的亲儿子. 先把代码贴上来吧,挺简单的. ##.链接账号密码 ...

  10. 关于angular双向绑定的一个问题,百度无果,还请帮忙解惑。

    用了一段时间anjular蛮好用的.其实用的功能不多.主要用于列表数据绑定以及一些简单效果的绑定,但是最近出现一个现象,百度无果,居然没有人遇到.现在描述一下,截图不方便,希望有人解惑. 列表ng-r ...