2015年9月7日

ios时间处理

摘要: 1.获取时间的年,月,日,时,分,秒 1 //"expireDatetime": "2015-07-28 17:29:48.0" 转换 2 NSString *dateStr = [model.expireDatetime substringToIndex:model.expir... 阅读全文

posted @ 2015-09-07 15:17 Baymax01 阅读(131) 评论(0) 推荐(0) 编辑

剪裁图片

摘要: 方法一: //背景图片 UIImageView *bgImageView = [MyUtil createImageViewFrame:CGRectMake(0, 0, 65, 23) imageName:@"StarsBackground"]; [self addSubview:bgImageVi 阅读全文

posted @ 2015-09-07 15:15 Baymax01 阅读(74) 评论(0) 推荐(0) 编辑

GCD详情

摘要: 1 #import "ViewController.h" 2 3 @interface ViewController () 4 5 @end 6 7 @implementation ViewController 8 9 - (void)viewDidLoad { 10 [super viewDidLoad]; 11 // Do an... 阅读全文

posted @ 2015-09-07 15:09 Baymax01 阅读(169) 评论(0) 推荐(0) 编辑

GCD

摘要: 1 //GCD (grand central dispatcher) 2 //队列 3 4 //串行队列 5 //前面的现场执行完成,才会开始执行后面加入的线程 6 //并行队列 7 //前面加入的线程和后面加入的线程同时执行 8 9 //1.主线程所在的串行队列 10 //系统自动创建这个队列... 阅读全文

posted @ 2015-09-07 15:08 Baymax01 阅读(184) 评论(0) 推荐(0) 编辑

Block详情

摘要: 1 #import "ViewController.h" 2 3 @interface ViewController () 4 5 @end 6 7 @implementation ViewController 8 9 - (void)viewDidLoad { 10 ... 阅读全文

posted @ 2015-09-07 15:07 Baymax01 阅读(129) 评论(0) 推荐(0) 编辑

使用Block,线程封装网络请求

摘要: 1.MyDownloader.h 1 #import <Foundation/Foundation.h> 2 3 @interface MyDownloader : NSObject 4 5 -(void)downloadWithUrlString:(NSString *)urlString fin 阅读全文

posted @ 2015-09-07 15:06 Baymax01 阅读(179) 评论(0) 推荐(0) 编辑

同步,异步,串行,并行队列

摘要: 1 #import "ViewController.h" 2 3 @interface ViewController () 4 5 @end 6 7 @implementation ViewController 8 9 - (void)viewDidLoad { 10 [super viewDidLoad]; 11 // Do an... 阅读全文

posted @ 2015-09-07 15:06 Baymax01 阅读(217) 评论(0) 推荐(0) 编辑

线程的优先级

摘要: 1 NSThread *t1 = [[NSThread alloc] initWithTarget:self selector:@selector(createThreadOne) object:nil]; 2 t1.name = @"线程A"; 3 //修改优先级 4 t1.threadPriority = 0; 5 [t1 start]; ... 阅读全文

posted @ 2015-09-07 15:03 Baymax01 阅读(143) 评论(0) 推荐(0) 编辑

NSThread创建线程

摘要: 1 #import "ViewController.h" 2 3 @interface ViewController () 4 5 @end 6 7 @implementation ViewController 8 9 - (void)viewDidLoad { 10 [super viewDidLoad]; 11 // Do any additiona... 阅读全文

posted @ 2015-09-07 14:57 Baymax01 阅读(147) 评论(0) 推荐(0) 编辑

线程NSOperationQueue

摘要: 1.NSOperationQueue下载图片 1 #import "ViewController.h" 2 #import "ImageOperation.h" 3 4 @interface ViewController () 5 { 6 NSOperationQueue *_queue; 7 } 阅读全文

posted @ 2015-09-07 14:54 Baymax01 阅读(135) 评论(0) 推荐(0) 编辑

KVC

摘要: 使用:[fanye setValuesForKeysWithDictionary:dic];如果出现关键字,则重写setter方法@property (nonatomic,copy,setter=setDescription:)NSString *myDescription;记得在.m文件加上-(v... 阅读全文

posted @ 2015-09-07 14:49 Baymax01 阅读(119) 评论(0) 推荐(0) 编辑

跳转到AppStore下载

摘要: //跳转到appstore界面 if (self.dItem.itunesUrl) { //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.dItem.itunesUrl]]; NSString *url =... 阅读全文

posted @ 2015-09-07 14:32 Baymax01 阅读(266) 评论(0) 推荐(0) 编辑

数组的懒加载

摘要: //懒加载方式初始化数组(要用到数组时才初始化)-(NSMutableArray *)nearbyArray{ if (_nearbyArray == nil) { _nearbyArray = [NSMutableArray array]; } return _nearbyArray;}//调用L... 阅读全文

posted @ 2015-09-07 14:30 Baymax01 阅读(271) 评论(0) 推荐(0) 编辑

Block的强强引用问题(循环引用)

摘要: 1 //block传值 2 __weak SubjectViewController *weakSelf = self;//解决强强引用的问题 3 cell.clickBlock = ^(AppItem *aItem){ 4 DetailViewControlle... 阅读全文

posted @ 2015-09-07 14:15 Baymax01 阅读(300) 评论(0) 推荐(0) 编辑

自己封装的下载方法

摘要: 1.MyDownloader.h文件 1 #import <Foundation/Foundation.h> 2 3 //前置声明 4 @class MyDownloader; 5 //协议 6 @protocol MyDownloaderDelegate <NSObject> 7 8 //下载失败 阅读全文

posted @ 2015-09-07 14:10 Baymax01 阅读(215) 评论(0) 推荐(0) 编辑

MJRefresh上拉刷新下拉加载

摘要: 1.创建 1 //下拉刷新 2 _headerView = [MJRefreshHeaderView header]; 3 _headerView.scrollView = _tbView; 4 _headerView.delegate = self; 5 6 ... 阅读全文

posted @ 2015-09-07 14:05 Baymax01 阅读(191) 评论(0) 推荐(0) 编辑

OC对数组排序的方法

摘要: 方法一: 使用sortUsingSelector如: [_cards sortUsingSelector:@selector(isSortByContactName:)];[_cards sortUsingSelector:@selector(isSortBYPhoneNumber:)];-(BOO... 阅读全文

posted @ 2015-09-07 13:57 Baymax01 阅读(206) 评论(0) 推荐(0) 编辑

sqlite事务处理

摘要: 1 //插入批量数据,可启用事务 2 - (void)insertDataWithCount:(NSInteger)count isUseTransaction:(BOOL)isUse{ 3 if (isUse) { 4 //手动启用事务 5 BOOL is... 阅读全文

posted @ 2015-09-07 11:50 Baymax01 阅读(233) 评论(0) 推荐(0) 编辑

导航