iOS开发——笔记篇&关于字典plist读取/字典转模型/自定义View/MVC/Xib的使用/MJExtension使用总结
关于字典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使用总结的更多相关文章
- ios开发——笔记篇
:开关 BOOL isopen = !isopen; //View @property (nonatomic, assign) BOOL open;//模型属性 self.group.open = ! ...
- iOS开发UI篇—字典转模型
iOS开发UI篇—字典转模型 一.能完成功能的“问题代码” 1.从plist中加载的数据 2.实现的代码 // // LFViewController.m // 03-应用管理 // // Creat ...
- iOS开发UI篇—ios应用数据存储方式(XML属性列表-plist)
iOS开发UI篇—ios应用数据存储方式(XML属性列表-plist) 一.ios应用常用的数据存储方式 1.plist(XML属性列表归档) 2.偏好设置 3.NSKeydeArchiver归档(存 ...
- IOS开发笔记(4)数据离线缓存与读取
IOS开发笔记(4)数据离线缓存与读取 分类: IOS学习2012-12-06 16:30 7082人阅读 评论(0) 收藏 举报 iosiOSIOS 方法一:一般将服务器第一次返回的数据保存在沙盒里 ...
- iOS开发UI篇—简单的浏览器查看程序
iOS开发UI篇—简单的浏览器查看程序 一.程序实现要求 1.要求 2. 界面分析 (1) 需要读取或修改属性的控件需要设置属性 序号标签 图片 图片描述 左边按钮 右边按钮 (2) 需要监听响应事件 ...
- iOS开发UI篇—从代码的逐步优化看MVC
iOS开发UI篇—从代码的逐步优化看MVC 一.要求 要求完成下面一个小的应用程序. 二.一步步对代码进行优化 注意:在开发过程中,优化的过程是一步一步进行的.(如果一个人要吃五个包子才能吃饱,那么他 ...
- iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序 一.plist文件和项目结构图 说明:这是一个嵌套模型的示例 二.代码示例: YYcarsgroup.h文件代码: // // YYcar ...
- iOS开发数据库篇—SQLite简单介绍
iOS开发数据库篇—SQLite简单介绍 一.离线缓存 在项目开发中,通常都需要对数据进行离线缓存的处理,如新闻数据的离线缓存等. 说明:离线缓存一般都是把数据保存到项目的沙盒中.有以下几种方式 (1 ...
- iOS开发UI篇—xib的简单使用
iOS开发UI篇—xib的简单使用 一.简单介绍 xib和storyboard的比较,一个轻量级一个重量级. 共同点: 都用来描述软件界面 都用Interface Builder工具来编辑 不同点: ...
随机推荐
- HDU 2056 Rectangles
Rectangles Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- 16、编写适应多个API Level的APK
确认您是否需要多apk支持 当你试图创建一个支持跨多代android系统的应用程序时,很自然的 你希望你的应用程序可以在新设备上使用新特性,并且不会牺牲向后兼 容.刚开始的时候认为通过创建多个ap ...
- BLOCK 死循环
__weak typeof(self) weakSelf = self; myObj.myBlock = ^{ __strong typeof(self) strongSelf = weak ...
- 转载--详解tomcat配置
http://www.importnew.com/17124.html 原文链接 几乎所有容器类型的应用都会包含一个名为 server.xml 的文件结构.基本上,其中的每个元数据或者配置都是容器完 ...
- python学习之subprocess模块
subprocess.Popen 这个模块主要就提供一个类Popen: class subprocess.Popen( args, bufsize=0, executable=None, stdin= ...
- linux 下的进程管理工具 supervisor
在linux下监控进程: 1)yum install python-setuptools linux下的python安装工具 2)easy_install supervisor 安装sup ...
- 【Spark学习】Apache Spark集群硬件配置要求
Spark版本:1.1.1 本文系从官方文档翻译而来,转载请尊重译者的工作,注明以下链接: http://www.cnblogs.com/zhangningbo/p/4135912.html 目录 存 ...
- Gym 100507C Zhenya moves from parents (线段树)
Zhenya moves from parents 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/C Description Z ...
- Spring properties dependency checking
In Spring,you can use dependency checking feature to make sure the required properties have been set ...
- 一个word合并项目的分布式架构设计
一个word合并项目的分布式架构设计 项目背景与问题起源 我们要给一个客户做word生成报告以及报告合并的工作,要合并的报告非常多,而且每个报告也比较大,一个多的报告大概有200页以上.我们用c#操作 ...