随笔分类 -  Objective-C

OC基础知识
NSTimer
摘要:如下代码所示,是我们最常见的使用timer的方式 @property (nonatomic , strong) NSTimer *animationTimer;self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:(self.an 阅读全文

posted @ 2016-02-04 11:13 Baymax01 阅读(170) 评论(0) 推荐(0)

NSSearchPathForDirectoriesInDomains用法
摘要:1.iPhone会为每一个应用程序生成一个私有目录,这个目录位于:/Users/sundfsun2009/Library/Application Support/iPhone Simulator/User/Applications下,并随即生成一个数字字母串作为目录名,在每一次应用程序启动时,这个字... 阅读全文

posted @ 2015-09-22 17:11 Baymax01 阅读(270) 评论(0) 推荐(0)

使用post请求下载数据
摘要://下载数据 -(void)requestData { NSURL *url = [NSURL URLWithString:kVerify]; //转码 //urlStr= [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSMutableURLRequest *reque... 阅读全文

posted @ 2015-09-13 19:17 Baymax01 阅读(399) 评论(0) 推荐(0)

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 阅读(135) 评论(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 阅读(136) 评论(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 阅读(181) 评论(0) 推荐(0)

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

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

OC对数组排序的方法
摘要:方法一: 使用sortUsingSelector如: [_cards sortUsingSelector:@selector(isSortByContactName:)];[_cards sortUsingSelector:@selector(isSortBYPhoneNumber:)];-(BOO... 阅读全文

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

导航