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. 96.extjs 页面

    1.登录js /** * @author sux * @desc 登录 */ Ext.onReady(function(){ Ext.QuickTips.init(); //错误信息显示必须 var ...

  2. ie8 不支持 position:fixed 的简单解决办法

    今天发现使用 position:fixed 的页面在firefox下没有问题,在IE8下却不能正常显示,在网上找了找,有不少相关文章,但是不是不起作用就是太复杂,后来终于发现一个简单的解决办法,就是在 ...

  3. mysql行列转置

    --创建行转列表及插入数据 create table tb_RowConvertToColumn ( username nvarchar(100) null, course nvarchar(100) ...

  4. BZOJ 2969 期望

    思路: 我们可以分开算每个格子自己的期望啊... 期望可以累加的 那就把这个大格子 分成 9个部分 分别算好了... //By SiriusRen #include <cmath> #in ...

  5. view在使用shape属性加圆角的同时,用代码修改其他background属性(例如颜色)不生效

    项目中一个TextView控件设置了shape属性,给其加了圆角,如下: houlder.mtxtGovernmentType.setBackgroundResource(R.drawable.tv_ ...

  6. Oracle存储过程给变量赋值的方法

    截止到目前我发现有三种方法可以在存储过程中给变量进行赋值: 1.直接法     := 如:v_flag := 0; 2.select into 如:假设变量名为v_flag,select count( ...

  7. 题解 P2605 【[ZJOI2010]基站选址】(From luoguBlog)

    线段树优化dp 数组f[i][j]表示在前i个村庄内,第j个基站建在i处的最小费用 根据交线牛逼法和王鹤松式可得方程 f[i][j]=min(f[k][j−1]+cost(k,i)) cost(k,i ...

  8. javascript中的计算题

    一.js中的数据类型共六种: 值类型五种:Boolea   Number  String  Null  undefined 引用类型:Object ----三大引用类型:Object   Array  ...

  9. encodeURI和encodeURIComponent的区别?

    encodeURI方法不会对下列字符编码 ASCII字母.数字.~!@#$&*()=:/,;?+' encodeURIComponent方法不会对下列字符编码 ASCII字母.数字.~!*() ...

  10. 洛谷P1443 马的遍历【BFS】

    题目描述 有一个n*m的棋盘(1<n,m<=400),在某个点上有一个马,要求你计算出马到达棋盘上任意一个点最少要走几步 输入输出格式 输入格式: 一行四个数据,棋盘的大小和马的坐标 输出 ...