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. nested exception is java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter

    转自:https://blog.csdn.net/licheng989/article/details/28929411 在Bean中有代码 public abstract Axe getAxe(); ...

  2. python 函数参数的传递(参数带星号的说明)

    python中函数参数的传递是通过赋值来传递的.函数参数的使用又有俩个方面值得注意:1.函数参数是如何定义的 2.在调用函数的过程中参数是如何被解析 先看第一个问题,在python中函数参数的定义主要 ...

  3. diaowen Maven Webapp

    五月 , :: 上午 org.apache.catalina.startup.VersionLoggerListener log INFO: Server version: Apache Tomcat ...

  4. Java压缩技术(二) ZIP压缩——Java原生实现

    原文:http://snowolf.iteye.com/blog/642298 去年整理了一篇ZLib算法Java实现(Java压缩技术(一) ZLib),一直惦记却没时间补充.今天得空,整理一下ZI ...

  5. codevs2800送外卖(floyd+状压dp)

    2800 送外卖  时间限制: 2 s  空间限制: 256000 KB  题目等级 : 钻石 Diamond     题目描述 Description 有一个送外卖的,他手上有n份订单,他要把n份东 ...

  6. Win10切换JDK版本

    开发项目由于使用JDK版本不同,来回配置环境变量有点繁琐,用了一天百度得到的方法 1:安装不同版本的JDK,这个应该都可以完成 2:配置环境变量 CLASSPATH.;%JAVA_HOME%\lib\ ...

  7. [转]RDLC报表——动态添加列

    本文转自:http://www.cnblogs.com/pszw/archive/2012/07/19/2599937.html 前言 最近接到一个需求:在给定的数据源中,某(些)列,可能需要单独统计 ...

  8. Spring Boot (14) 数据源配置原理

    数据源配置源码 这里截取org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration的部分源码,主要介绍Tomcat和Hika ...

  9. mvc3结合spring.net-依赖注入

    namespace Tuzi.Models.IService { public interface IPersonService { string say(string words); } names ...

  10. 百鸡百钱===百马百担====for循环嵌套

    package com.zuoye.test;//百鸡百钱5文钱可以买一只公鸡,3文钱可以买一只母鸡,1文钱可以买3只雏鸡.public class Baiji { public static voi ...