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. Winform 异步调用

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  2. C - Domino piling

    Problem description You are given a rectangular board of M × N squares. Also you are given an unlimi ...

  3. Tomcat 程序无问题的情况下页面打开变慢的原因

    看看这写日志的频率就知道我有多闲了.. 前言: 其实关于tomcat,遇到过很多关于“慢”的问题,比如启动慢,比如页面打开慢, 以前太忙也太懒,不愿意花时间分析原因,现在终于肯静下来找原因 环境是ec ...

  4. 前端-git思维导图笔记

    命令汇总 git config配置本地仓库 常用git config --global user.name.git config --global user.email git config --li ...

  5. 【MySQL】源码安装

    操作系统:Red Hat Enterprise Linux Server release 6.5 Mysql安装包:mysql-5.6.4-m7.tar.zip,下载地址:http://pan.bai ...

  6. Assembly之Instruction之Byte and Word

    Byte and word issues The MSP430 is byte-addressed, and little-endian. Word operands must be located ...

  7. SQL Server对数据进行添加

    下面介绍一下SQL Server如何往数据库中加入数据. <!-- 添加主人信息 --> <form action="add_Admin.jsp" method= ...

  8. JAVA软件工程师应该具备哪些基本素质?

    必知:软件企业要求基础软件工程师具备六大基本素质,即良好的编码能力.自觉的规范意识和团队精神.认识和运用数据库的能力.较强的英语阅读和写作能力.具有软件工程的概念和求知欲和进取心. 1.良好的编码能力 ...

  9. MQTTnet 的Asp.Net Core 认证事件的扩展

    MQTTnet 的数据接收 连接 等事件都很丰富, 唯独客户端连接验证不能依赖注入也不能很舒服的使用事件的方式, 因此MQTTnet.AspNetCoreEx 就出现了. 示例如下:在  public ...

  10. xpath 获取深圳房源信息并导出csv

    # -*- coding: utf-8 -*- # @Time : 2019/4/28 10:44 # @Author : wujf # @Email : 1028540310@qq.com # @F ...