Runloop 概述1、与下面知识相关:系统级:GCD,mach kernel,block,pthread应用层:NSTimer,UIEvent,自动释放池,NSObject(NSDelayedPerforming),NSObject(NSThreadPerformAddition),CADisplayLink,CATransition,CAAnimation,dispatch_get_main_...
分类:
其他好文 时间:
2016-06-30 12:55:34
阅读次数:
490
一、android中为什么使用多线程 Android中主线程不能执行耗时操作、不能访问网络等。这些动作会导致主线程被阻塞,容易引起ANR(Application no response)异常。所以必须把访问网络、耗时操作等放入到子线程中执行。Android的主线程(UI线程)是线程不安全的,所以当各 ...
分类:
移动开发 时间:
2016-06-27 17:26:35
阅读次数:
269
6种状态 New(新创建) Runnable(可运行) Blocked(被阻塞) Waiting(等待) Timed waiting(计时等待) Terminated(被终止) 当用new创建一个新线程时,如new Thread(r),该线程还没有开始运行。 一旦调用start方法,线程处于runn ...
分类:
编程语言 时间:
2016-06-27 15:40:02
阅读次数:
230
原文网址:http://blog.csdn.net/enuola/article/details/8099461 调用一次计时器方法: [cpp] view plain copy myTimer = [NSTimer scheduledTimerWithTimeInterval:1.5 target ...
分类:
移动开发 时间:
2016-06-21 22:27:47
阅读次数:
219
原文网址:http://my.oschina.net/u/2340880/blog/398598 NSTimer在IOS开发中会经常用到,尤其是小型游戏,然而对于初学者时常会注意不到其中的内存释放问题,将其基本用法总结如下: 一、初始化方法:有五种初始化方法,分别是 + (NSTimer *)tim ...
分类:
移动开发 时间:
2016-06-21 22:23:34
阅读次数:
187
原文网址:http://www.cnblogs.com/zhulin/archive/2012/02/02/2335866.html 1、初始化 + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget sele ...
分类:
移动开发 时间:
2016-06-21 22:21:01
阅读次数:
219
原文网址:http://blog.csdn.net/tangshoulin/article/details/7644124 1、初始化 + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector: ...
分类:
移动开发 时间:
2016-06-21 22:12:46
阅读次数:
262
1NSString+YYAdd 2NSNumber+YYAdd 3.NSArray+YYAdd 4.NSTimer+YYAdd 5.NSNotificationCenter+YYAdd 6UIImage+YYAdd 7.UIControl+YYAdd 8.UIBarButtonItem+YYAdd ...
分类:
其他好文 时间:
2016-06-20 06:52:06
阅读次数:
847
基础知识 作用 保持程序持续运行 处理app中的各种事件(如触摸事件、定时器事件【NSTimer】、selector事件【选择器·performSelector···】) 节省CPU资源,提高程序性能 说明 没有RunLoop,那么程序一启动就会退出 有了Runoop,那么相当于在内部有一个死循环, ...
分类:
其他好文 时间:
2016-06-18 18:37:48
阅读次数:
256
网络图片查看器 1. 确定图片的网址 2. 发送http请求 3. 服务器的图片是以流的形式返回给浏览器的 4. 把位图对象显示至ImageView 需要添加权限 网络请求 主线程阻塞 在Android中,主线程被阻塞会导致UI停止刷新,用户体验将非常差,若主线程阻塞时间过长,就会抛出ANR(App ...
分类:
移动开发 时间:
2016-06-18 17:02:06
阅读次数:
199