算法
baii
做最好的自己
展开
-
iOS代码只执行一遍(GCD)
static dispatch_once_t disOnce; dispatch_once(&disOnce, ^ { // 代码 });原创 2016-01-26 10:34:50 · 332 阅读 · 0 评论 -
iOS block简单使用
一.什么是Blocks Blocks是C语言的扩充功能。如果用一句话来概括就是:带有自动变量的匿名函数。 第一次看见Blocks的时候,感觉很类似C语言的函数指针,尤其是Block类型变量,更是有极强的相似度。但Blocks不是一个指针,而是一个不带名字的函数,它允许开发者在两个对象之间将任意的语句当作数据进行传递,所以在一些场合使用Blocks很方便简洁。原创 2016-01-21 17:43:56 · 320 阅读 · 0 评论 -
IOS中定时器NSTimer的开启与关闭
调用一次计时器方法: [cpp] view plain copy myTimer = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(scrollTimer) userInfo:nil repeats:NO]; //不重复,只调原创 2016-01-21 17:41:36 · 293 阅读 · 0 评论 -
iOS给个日期 判断今天昨天前天
-(NSString *)compareDate:(NSDate *)date{ NSTimeInterval secondsPerDay = 24 * 60 * 60; NSDate *today = [[NSDate alloc] init]; NSDate *tomorrow, *yesterday; tomorrow = [tod转载 2016-01-21 16:35:27 · 1925 阅读 · 0 评论 -
遍历数组
#pragma mark Array数组的四种遍历方法 void testArray(){ Blog *blog1 = [[Blog blog] setBlogTitle:@"Love" andContent:@"I love you"]; Blog *blog2 = [[Blog blog] setBlogTitle:@"Friend转载 2016-01-19 10:47:38 · 276 阅读 · 0 评论 -
本地推送
一.本地推送 1.什么是本地推送 本地推送就是新建一条固定时间推送过来的消息,不需要网络.可以做闹钟之类的功能 2.创建本地推送消息 UILocalNotification *localNoti = [[UILocalNotification alloc]init]; localNoti.fireDate = [NSDate dat原创 2016-03-29 10:16:17 · 498 阅读 · 0 评论 -
Socket使用
一.什么是Socket socket起源于Unix,而Unix/Linux基本哲学之一就是“一切皆文件”,都可以用“打开open –> 读写write/read –> 关闭close”模式来操作。我的理解就是Socket就是该模式的一个实现,socket即是一种特殊的文件,一些socket函数就是对其进行的操作(读/写IO、打开、关闭)。 二.TCPSocket的使用 1.TCP原创 2016-03-29 10:18:26 · 289 阅读 · 0 评论 -
IOS开发基础篇--NSNotificationCenter使用小结
IOS开发基础篇--NSNotificationCenter使用小结 一、NSNotification和Delegate的联系和区别 众所周知,IOS中经常会使用到NSNotification和delegate来进行一些类之间的消息传递。言归正传,这两种有什么区别呢? NSNotification就是IOS提供的一个消息中心,由一个全局的defaultNotifica转载 2016-03-29 10:26:17 · 573 阅读 · 1 评论 -
文件路径及管理的一些方法
清除pro配置文件 ~/Library/MobileDevice/Provisioning Profiles 终端打开文件路径(文件异常,提交SVN有残留git svn) find . -type d -name ".svn" |xargs rm -rvf find . -type d -name ".git" |xargs rm -rvf原创 2016-04-25 09:54:07 · 351 阅读 · 0 评论