关于字典plist读取/字典转模型/自定义View/MVC/Xib的使用/MJExtension使用总结

一:Plist读取

 /******************************************************************************/
 一:简单plist读取

 :定义一个数组用来保存读取出来的plist数据
 @property (nonatomic, strong) NSArray *shops;

 :使用懒加载的方式加载plist文件,并且放到数组中
 // 懒加载
 // 1.第一次用到时再去加载
 // 2.只会加载一次
 - (NSArray *)shops
 {
     if (_shops == nil) {
         // 获得plist文件的全路径
         NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];

         // 从plist文件中加载一个数组对象
         _shops = [NSArray arrayWithContentsOfFile:file];
     }
     return _shops;
 }

 :使用数组中的数据
 // 设置数据
 NSDictionary *shop = self.shops[index];
 iconView.image = [UIImage imageNamed:shop[@"icon"]];
 nameLabel.text = shop[@"name"];

 /******************************************************************************/

二:字典转模型

 二:字典转模型

 :创建一个model类并且在里面创建对应的模型属性
 /** 名字 */
 @property (nonatomic, strong) NSString *name;
 /** 图标 */
 @property (nonatomic, strong) NSString *icon;

 :定义一个数组用来保存读取出来的plist数据
 @property (nonatomic, strong) NSMutableArray *shops;

 :使用懒加载的方式加载plist文件,并且放到模型中

 // 懒加载
 // 1.第一次用到时再去加载
 // 2.只会加载一次
 - (NSMutableArray *)shops
 {
     if (_shops == nil) {
         // 创建"模型数组"
         _shops = [NSMutableArray array];

         // 获得plist文件的全路径
         NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];

         // 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
         NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];

         // 将 “字典数组” 转换为 “模型数据”
         for (NSDictionary *dict in dictArray) { // 遍历每一个字典
             // 将 “字典” 转换为 “模型”
             Shop *shop = [[Shop alloc] init];
             shop.name = dict[@"name"];
             shop.icon = dict[@"icon"];

             // 将 “模型” 添加到 “模型数组中”
             [_shops addObject:shop];
         }
     }
     return _shops;
 }

 :使用模型中的数据
 // 设置数据
 Shop *shop = self.shops[index];
 iconView.image = [UIImage imageNamed:shop.icon];
 nameLabel.text = shop.name;

 /******************************************************************************/

三:字典转模型疯转

 二:字典转模型封装

 :创建一个model类并且在里面创建对应的模型属性,定义两个模型方法
 /** 名字 */
 @property (nonatomic, copy) NSString *name;
 /** 图标 */
 @property (nonatomic, copy) NSString *icon;

 /** 通过一个字典来初始化模型对象 */
 - (instancetype)initWithDict:(NSDictionary *)dict;

 /** 通过一个字典来创建模型对象 */
 + (instancetype)shopWithDict:(NSDictionary *)dict;

 :模型方法的实现
 - (instancetype)initWithDict:(NSDictionary *)dict
 {
     if (self = [super init]) {
         self.name = dict[@"name"];
         self.icon = dict[@"icon"];
     }
     return self;
 }

 + (instancetype)shopWithDict:(NSDictionary *)dict
 {
     // 这里要用self
     return [[self alloc] initWithDict:dict];
 }

 :定义一个数组用来保存读取出来的plist数据
 @property (nonatomic, strong) NSMutableArray *shops;

 :使用懒加载的方式加载plist文件,并且放到模型中
 // 懒加载
 // 1.第一次用到时再去加载
 // 2.只会加载一次
 - (NSMutableArray *)shops
 {
     if (_shops == nil) {
         // 创建"模型数组"
         _shops = [NSMutableArray array];

         // 获得plist文件的全路径
         NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];

         // 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
         NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];

         // 将 “字典数组” 转换为 “模型数据”
         for (NSDictionary *dict in dictArray) { // 遍历每一个字典
             // 将 “字典” 转换为 “模型”
             XMGShop *shop = [XMGShop shopWithDict:dict];

             // 将 “模型” 添加到 “模型数组中”
             [_shops addObject:shop];
         }
     }
     return _shops;
 }

 :使用模型中的数据
 // 设置数据
 XMGShop *shop = self.shops[index];
 iconView.image = [UIImage imageNamed:shop.icon];
 nameLabel.text = shop.name;

 /******************************************************************************/

四:自定义View

 四:自定义View

 :创建一个model类并且在里面创建对应的模型属性,定义两个模型方法
 /** 名字 */
 @property (nonatomic, copy) NSString *name;
 /** 图标 */
 @property (nonatomic, copy) NSString *icon;

 /** 通过一个字典来初始化模型对象 */
 - (instancetype)initWithDict:(NSDictionary *)dict;

 /** 通过一个字典来创建模型对象 */
 + (instancetype)shopWithDict:(NSDictionary *)dict;

 :模型方法的实现
 - (instancetype)initWithDict:(NSDictionary *)dict
 {
     if (self = [super init]) {
         self.name = dict[@"name"];
         self.icon = dict[@"icon"];
     }
     return self;
 }

 + (instancetype)shopWithDict:(NSDictionary *)dict
 {
     // 这里要用self
     return [[self alloc] initWithDict:dict];
 }

 :自定义一个View,引入模型类,并且创建模型类的属性

 @class XMGShop;

 /** 商品模型 */
 @property (nonatomic, strong) XMGShop *shop;

 :实现文件中,定义相应的控件属性
 /** 图片 */
 @property (nonatomic, weak) UIImageView *iconView;

 /** 名字 */
 @property (nonatomic, weak) UILabel *nameLabel;

 :实现自定义View的相应方法
 - (instancetype)init
 {
     if (self = [super init]) {
         // 添加一个图片
         UIImageView *iconView = [[UIImageView alloc] init];
         [self addSubview:iconView];
         self.iconView = iconView;

         // 添加一个文字
         UILabel *nameLabel = [[UILabel alloc] init];
         nameLabel.textAlignment = NSTextAlignmentCenter;
         [self addSubview:nameLabel];
         self.nameLabel = nameLabel;
     }
     return self;
 }

 /**
  * 这个方法专门用来布局子控件,设置子控件的frame
  */
 - (void)layoutSubviews
 {
     // 一定要调用super方法
     [super layoutSubviews];

     CGFloat shopW = self.frame.size.width;
     CGFloat shopH = self.frame.size.height;

     self.iconView.frame = CGRectMake(, , shopW, shopW);
     self.nameLabel.frame = CGRectMake(, shopW, shopW, shopH - shopW);
 }

 -(void)setShop:(XMGShop *)shop
 {
     _shop = shop;

     self.iconView.image = [UIImage imageNamed:shop.icon];
     self.nameLabel.text = shop.name;
 }
 :定义一个数组用来保存读取出来的plist数据
 @property (nonatomic, strong) NSMutableArray *shops;

 :使用懒加载的方式加载plist文件,并且放到模型中
 // 懒加载
 // 1.第一次用到时再去加载
 // 2.只会加载一次
 - (NSMutableArray *)shops
 {
     if (_shops == nil) {
         // 创建"模型数组"
         _shops = [NSMutableArray array];

         // 获得plist文件的全路径
         NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];

         // 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
         NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];

         // 将 “字典数组” 转换为 “模型数据”
         for (NSDictionary *dict in dictArray) { // 遍历每一个字典
             // 将 “字典” 转换为 “模型”
             XMGShop *shop = [XMGShop shopWithDict:dict];

             // 将 “模型” 添加到 “模型数组中”
             [_shops addObject:shop];
         }
     }
     return _shops;
 }

 :使用View
 // 创建一个商品父控件
 XMGShopView *shopView = [[XMGShopView alloc] init];
 shopView.frame = CGRectMake(shopX, shopY, shopW, shopH);
 // 将商品父控件添加到shopsView中
 [self.shopsView addSubview:shopView];

 /**

  NSDictionary *dict = nil; // 从其他地方加载的字典

  XMGShop *shop = [XMGShop shopWithDict:dict];

  XMGShopView *shopView = [[XMGShopView alloc] init];
  shopView.shop = shop;
  shopView.frame = CGRectMake(0, 0, 70, 100);
  [self.view addSubview:shopView];

  // 扩展性差
  // 扩展好的体现:即使改变了需求。我们也不需要动大刀子
  */

 /******************************************************************************/

五:initWithFrame

 五:initWithFrame
 :在上一步的基础上只要修改init方法为
 /** init方法内部会自动调用initWithFrame:方法 */
 - (instancetype)initWithFrame:(CGRect)frame
 {
     if (self = [super initWithFrame:frame]) {
         // 添加一个图片
         UIImageView *iconView = [[UIImageView alloc] init];
         [self addSubview:iconView];
         self.iconView = iconView;

         // 添加一个文字
         UILabel *nameLabel = [[UILabel alloc] init];
         nameLabel.textAlignment = NSTextAlignmentCenter;
         [self addSubview:nameLabel];
         self.nameLabel = nameLabel;
     }
     return self;
 }

 :最后设置数据的时候也可以使用下面的方法实现View的创建
 XMGShopView *shopView = [[XMGShopView alloc] initWithFrame:CGRectMake(shopX, shopY, shopW, shopH)];

 /******************************************************************************/

六:MVC

 六:MVC

 :model
 @interface XMGShop : NSObject
 /** 名字 */
 @property (nonatomic, copy) NSString *name;
 /** 图标 */
 @property (nonatomic, copy) NSString *icon;
 /** 通过一个字典来初始化模型对象 */
 - (instancetype)initWithDict:(NSDictionary *)dict;

 /** 通过一个字典来创建模型对象 */
 + (instancetype)shopWithDict:(NSDictionary *)dict;
 @end

 @implementation XMGShop

 - (instancetype)initWithDict:(NSDictionary *)dict
 {
     if (self = [super init]) {
         self.name = dict[@"name"];
         self.icon = dict[@"icon"];
     }
     return self;
 }

 + (instancetype)shopWithDict:(NSDictionary *)dict
 {
     // 这里要用self
     return [[self alloc] initWithDict:dict];
 }

 @end

 :view
 @class XMGShop;

 @interface XMGShopView : UIView
 /** 商品模型 */
 @property (nonatomic, strong) XMGShop *shop;

 - (instancetype)initWithShop:(XMGShop *)shop;
 + (instancetype)shopViewWithShop:(XMGShop *)shop;
 + (instancetype)shopView;
 @end

 @interface XMGShopView()
 /** 图片 */
 @property (nonatomic, weak) UIImageView *iconView;

 /** 名字 */
 @property (nonatomic, weak) UILabel *nameLabel;
 @end

 @implementation XMGShopView

 - (instancetype)initWithShop:(XMGShop *)shop
 {
     if (self = [super init]) {
         self.shop = shop;
     }
     return self;
 }

 + (instancetype)shopViewWithShop:(XMGShop *)shop
 {
     return [[self alloc] initWithShop:shop];
 }

 + (instancetype)shopView
 {
     return [[self alloc] init];
 }

 /** init方法内部会自动调用initWithFrame:方法 */
 - (instancetype)initWithFrame:(CGRect)frame
 {
     if (self = [super initWithFrame:frame]) {
         // 添加一个图片
         UIImageView *iconView = [[UIImageView alloc] init];
         [self addSubview:iconView];
         self.iconView = iconView;

         // 添加一个文字
         UILabel *nameLabel = [[UILabel alloc] init];
         nameLabel.textAlignment = NSTextAlignmentCenter;
         [self addSubview:nameLabel];
         self.nameLabel = nameLabel;
     }
     return self;
 }

 /**
  * 当前控件的frame发生改变的时候就会调用
  * 这个方法专门用来布局子控件,设置子控件的frame
  */
 - (void)layoutSubviews
 {
     // 一定要调用super方法
     [super layoutSubviews];

     CGFloat shopW = self.frame.size.width;
     CGFloat shopH = self.frame.size.height;

     self.iconView.frame = CGRectMake(, , shopW, shopW);
     self.nameLabel.frame = CGRectMake(, shopW, shopW, shopH - shopW);
 }

 - (void)setShop:(XMGShop *)shop
 {
     _shop = shop;

     self.iconView.image = [UIImage imageNamed:shop.icon];
     self.nameLabel.text = shop.name;
 }

 @end

 controller

 @property (nonatomic, strong) NSMutableArray *shops;

 // 懒加载
 // 1.第一次用到时再去加载
 // 2.只会加载一次
 - (NSMutableArray *)shops
 {
     if (_shops == nil) {
         // 创建"模型数组"
         _shops = [NSMutableArray array];

         // 获得plist文件的全路径
         NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];

         // 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
         NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];

         // 将 “字典数组” 转换为 “模型数据”
         for (NSDictionary *dict in dictArray) { // 遍历每一个字典
             // 将 “字典” 转换为 “模型”
             XMGShop *shop = [XMGShop shopWithDict:dict];

             // 将 “模型” 添加到 “模型数组中”
             [_shops addObject:shop];
         }
     }
     return _shops;
 }

 // 创建一个商品父控件
 XMGShopView *shopView = [XMGShopView shopViewWithShop:self.shops[index]];
 // 设置frame
 shopView.frame = CGRectMake(shopX, shopY, shopW, shopH);
 // 将商品父控件添加到shopsView中
 [self.shopsView addSubview:shopView];

 /******************************************************************************/

七:Xib的使用

 七:XIB

 :xibView中
 /** 商品模型 */
 @property (nonatomic, strong) XMGShop *shop;
 + (instancetype)shopViewWithShop:(XMGShop *)shop;

 + (instancetype)shopViewWithShop:(XMGShop *)shop
 {
     // self == XMGShopView
     // NSStringFromClass(self) == @"XMGShopView"
     XMGShopView *shopView = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
     shopView.shop = shop;
     return shopView;
 }

 - (void)setShop:(XMGShop *)shop
 {
     _shop = shop;

     UIImageView *iconView = (UIImageView *)[self viewWithTag:];
     iconView.image = [UIImage imageNamed:shop.icon];

     UILabel *nameLabel = (UILabel *)[self viewWithTag:];
     nameLabel.text = shop.name;
 }

 :控制器中设置数据
 // 从xib中加载一个商品控件
 XMGShopView *shopView = [XMGShopView shopViewWithShop:self.shops[index]];
 // 设置frame
 shopView.frame = CGRectMake(shopX, shopY, shopW, shopH);
 // 添加商品控件
 [self.shopsView addSubview:shopView];

八:牛逼框架MJExtension使用

 /******************************************************************************/
 八:MJExtension
 :是一套“字典和模型之间互相转换”的轻量级框架,模型属性
 /**
  *  微博文本内容
  */
 @property (copy, nonatomic) NSString *text;

 /**
  *  微博作者
  */
 @property (strong, nonatomic) User *user;

 /**
  *  转发的微博
  */
 @property (strong, nonatomic) Status *retweetedStatus;

 /**
  *  存放着某一页微博数据(里面都是Status模型)
  */
 @property (strong, nonatomic) NSMutableArray *statuses;

 /**
  *  总数
  */
 @property (assign, nonatomic) NSNumber *totalNumber;

 /**
  *  上一页的游标
  */
 @property (assign, nonatomic) long long previousCursor;

 /**
  *  下一页的游标
  */
 @property (assign, nonatomic) long long nextCursor;

 /**
  *  名称
  */
 @property (copy, nonatomic) NSString *name;

 /**
  *  头像
  */
 @property (copy, nonatomic) NSString *icon;

 :对应方法的实现
 /**
  MJ友情提醒:
  1.MJExtension是一套“字典和模型之间互相转换”的轻量级框架
  2.MJExtension能完成的功能
  * 字典 --> 模型
  * 模型 --> 字典
  * 字典数组 --> 模型数组
  * 模型数组 --> 字典数组
  3.具体用法主要参考 main.m中各个函数 以及 "NSObject+MJKeyValue.h"
  4.希望各位大神能用得爽
  */

 #import <Foundation/Foundation.h>
 #import "MJExtension.h"
 #import "User.h"
 #import "Status.h"
 #import "StatusResult.h"

 /**
  *  简单的字典 -> 模型
  */
 void keyValues2object()
 {
     // 1.定义一个字典
     NSDictionary *dict = @{
                            @"name" : @"Jack",
                            @"icon" : @"lufy.png",
                            };

     // 2.将字典转为User模型
     User *user = [User objectWithKeyValues:dict];

     // 3.打印User模型的属性
     NSLog(@"name=%@, icon=%@", user.name, user.icon);
 }

 /**
  *  复杂的字典 -> 模型 (模型里面包含了模型)
  */
 void keyValues2object2()
 {
     // 1.定义一个字典
     NSDictionary *dict = @{
                            @"text" : @"是啊,今天天气确实不错!",

                            @"user" : @{
                                    @"name" : @"Jack",
                                    @"icon" : @"lufy.png"
                                    },

                            @"retweetedStatus" : @{
                                    @"text" : @"今天天气真不错!",

                                    @"user" : @{
                                            @"name" : @"Rose",
                                            @"icon" : @"nami.png"
                                            }
                                    }
                            };

     // 2.将字典转为Status模型
     Status *status = [Status objectWithKeyValues:dict];

     // 3.打印status的属性
     NSString *text = status.text;
     NSString *name = status.user.name;
     NSString *icon = status.user.icon;
     NSLog(@"text=%@, name=%@, icon=%@", text, name, icon);

     // 4.打印status.retweetedStatus的属性
     NSString *text2 = status.retweetedStatus.text;
     NSString *name2 = status.retweetedStatus.user.name;
     NSString *icon2 = status.retweetedStatus.user.icon;
     NSLog(@"text2=%@, name2=%@, icon2=%@", text2, name2, icon2);
 }

 /**
  *  复杂的字典 -> 模型 (模型的数组属性里面又装着模型)
  */
 void keyValues2object3()
 {
     // 1.定义一个字典
     NSDictionary *dict = @{
                            @"statuses" : @[
                                    @{
                                        @"text" : @"今天天气真不错!",

                                        @"user" : @{
                                                @"name" : @"Rose",
                                                @"icon" : @"nami.png"
                                                }
                                        },

                                    @{
                                        @"text" : @"明天去旅游了",

                                        @"user" : @{
                                                @"name" : @"Jack",
                                                @"icon" : @"lufy.png"
                                                }
                                        },

                                    @{
                                        @"text" : @"嘿嘿,这东西不错哦!",

                                        @"user" : @{
                                                @"name" : @"Jim",
                                                @"icon" : @"zero.png"
                                                }
                                        }

                                    ],

                            ",

                            ",

                            "
                            };

     // 2.将字典转为StatusResult模型
     StatusResult *result = [StatusResult objectWithKeyValues:dict];

     // 3.打印StatusResult模型的简单属性
     NSLog(@"totalNumber=%d, previousCursor=%lld, nextCursor=%lld", result.totalNumber, result.previousCursor, result.nextCursor);

     // 4.打印statuses数组中的模型属性
     for (Status *status in result.statuses) {
         NSString *text = status.text;
         NSString *name = status.user.name;
         NSString *icon = status.user.icon;
         NSLog(@"text=%@, name=%@, icon=%@", text, name, icon);
     }
 }

 /**
  *  字典数组 -> 模型数组
  */
 void keyValuesArray2objectArray()
 {
     // 1.定义一个字典数组
     NSArray *dictArray = @[
                            @{
                                @"name" : @"Jack",
                                @"icon" : @"lufy.png",
                                },

                            @{
                                @"name" : @"Rose",
                                @"icon" : @"nami.png",
                                },

                            @{
                                @"name" : @"Jim",
                                @"icon" : @"zero.png",
                                }
                            ];

     // 2.将字典数组转为User模型数组
     NSArray *userArray = [User objectArrayWithKeyValuesArray:dictArray];

     // 3.打印userArray数组中的User模型属性
     for (User *user in userArray) {
         NSLog(@"name=%@, icon=%@", user.name, user.icon);
     }
 }

 /**
  *  模型 -> 字典
  */
 void object2keyValues()
 {
     // 1.新建模型
     User *user = [[User alloc] init];
     user.name = @"Jack";
     user.icon = @"lufy.png";

     Status *status = [[Status alloc] init];
     status.user = user;
     status.text = @"今天的心情不错!";

     // 2.将模型转为字典
     //    NSDictionary *dict = [status keyValues];
     NSDictionary *dict = status.keyValues;
     NSLog(@"%@", dict);
 }

 /**
  *  模型数组 -> 字典数组
  */
 void objectArray2keyValuesArray()
 {
     // 1.新建模型数组
     User *user1 = [[User alloc] init];
     user1.name = @"Jack";
     user1.icon = @"lufy.png";

     User *user2 = [[User alloc] init];
     user2.name = @"Rose";
     user2.icon = @"nami.png";

     User *user3 = [[User alloc] init];
     user3.name = @"Jim";
     user3.icon = @"zero.png";

     NSArray *userArray = @[user1, user2, user3];

     // 2.将模型数组转为字典数组
     NSArray *dictArray = [User keyValuesArrayWithObjectArray:userArray];
     NSLog(@"%@", dictArray);
 }

 int main(int argc, const char * argv[])
 {
     @autoreleasepool {
         // 简单的字典 -> 模型
         keyValues2object();

         // 复杂的字典 -> 模型 (模型里面包含了模型)
         keyValues2object2();

         // 复杂的字典 -> 模型 (模型的数组属性里面又装着模型)
         keyValues2object3();

         // 字典数组 -> 模型数组
         keyValuesArray2objectArray();

         // 模型转字典
         object2keyValues();

         // 模型数组 -> 字典数组
         objectArray2keyValuesArray();
     }
     ;
 }

iOS开发——笔记篇&关于字典plist读取/字典转模型/自定义View/MVC/Xib的使用/MJExtension使用总结的更多相关文章

  1. ios开发——笔记篇

    :开关 BOOL isopen = !isopen; //View @property (nonatomic, assign) BOOL open;//模型属性 self.group.open = ! ...

  2. iOS开发UI篇—字典转模型

    iOS开发UI篇—字典转模型 一.能完成功能的“问题代码” 1.从plist中加载的数据 2.实现的代码 // // LFViewController.m // 03-应用管理 // // Creat ...

  3. iOS开发UI篇—ios应用数据存储方式(XML属性列表-plist)

    iOS开发UI篇—ios应用数据存储方式(XML属性列表-plist) 一.ios应用常用的数据存储方式 1.plist(XML属性列表归档) 2.偏好设置 3.NSKeydeArchiver归档(存 ...

  4. IOS开发笔记(4)数据离线缓存与读取

    IOS开发笔记(4)数据离线缓存与读取 分类: IOS学习2012-12-06 16:30 7082人阅读 评论(0) 收藏 举报 iosiOSIOS 方法一:一般将服务器第一次返回的数据保存在沙盒里 ...

  5. iOS开发UI篇—简单的浏览器查看程序

    iOS开发UI篇—简单的浏览器查看程序 一.程序实现要求 1.要求 2. 界面分析 (1) 需要读取或修改属性的控件需要设置属性 序号标签 图片 图片描述 左边按钮 右边按钮 (2) 需要监听响应事件 ...

  6. iOS开发UI篇—从代码的逐步优化看MVC

    iOS开发UI篇—从代码的逐步优化看MVC 一.要求 要求完成下面一个小的应用程序. 二.一步步对代码进行优化 注意:在开发过程中,优化的过程是一步一步进行的.(如果一个人要吃五个包子才能吃饱,那么他 ...

  7. iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序

    iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序 一.plist文件和项目结构图 说明:这是一个嵌套模型的示例 二.代码示例: YYcarsgroup.h文件代码: // // YYcar ...

  8. iOS开发数据库篇—SQLite简单介绍

    iOS开发数据库篇—SQLite简单介绍 一.离线缓存 在项目开发中,通常都需要对数据进行离线缓存的处理,如新闻数据的离线缓存等. 说明:离线缓存一般都是把数据保存到项目的沙盒中.有以下几种方式 (1 ...

  9. iOS开发UI篇—xib的简单使用

    iOS开发UI篇—xib的简单使用 一.简单介绍 xib和storyboard的比较,一个轻量级一个重量级. 共同点: 都用来描述软件界面 都用Interface Builder工具来编辑 不同点: ...

随机推荐

  1. Winform之SpreadSheetGear转DevExpress.XtraSpreadsheet.v13.2 z

    DevExpress.XtraSpreadsheet.v13.2 允许用户创建.管理.打印.转换spreadsheet文件而不需要用户安装Office. 什么是Spreadsheet 可以看到最后就是 ...

  2. STM32查看系统时钟

    调用库函数RCC_GetClocksFreq,该函数可以返回片上的各种时钟的频率 函数原形  void  RCC_GetClocksFreq(RCC_ClocksTypeDef*  RCC_Clock ...

  3. BestCoder Round #76 解题报告

    DZY Loves Partition [思路] 贪心 [代码] #include <iostream> using namespace std; typedef long long ll ...

  4. Javascript原理

    1.javascript创建对象 创建新对象有两种不同的方法: 定义并创建对象的实例 person=new Object(); person.firstname="Bill"; p ...

  5. (R)?ex - A simple framework to simplify system administration and datacenter automation

    找工作-互联网招聘求职网-拉勾网 5-10年 (R)?ex - A simple framework to simplify system administration and datacenter ...

  6. 安装Sublime Text 2插件的方法

    1.直接安装 安装Sublime text 2插件很方便,可以直接下载安装包解压缩到Packages目录(菜单->preferences->packages). 2.使用Package C ...

  7. [iOS 多线程 & 网络 - 3.0] - 在线动画Demo

    A.需求 所有数据都从服务器下载 动画列表包含:图片.动画名标题.时长副标题 点击打开动画观看   code source: https://github.com/hellovoidworld/Vid ...

  8. [iOS UI进阶 - 2.0] 彩票Demo v1.0

    A.需求 1.模仿“网易彩票”做出有5个导航页面和相应功能的Demo 2.v1.0 版本搭建基本框架   code source:https://github.com/hellovoidworld/H ...

  9. 系统级性能分析工具 — Perf

    从2.6.31内核开始,linux内核自带了一个性能分析工具perf,能够进行函数级与指令级的热点查找. perf Performance analysis tools for Linux. Perf ...

  10. Python模块(Module)

    一个Python Module(模块),是一个文件,包含了Python对象定义和Python语句(definitions and statements).文件名就是模块名加上后缀.py,在模块内部,模 ...