ios RunLoop
2016-04-15 本文已影响0人
牛家村的枇杷


RunLoop
- 保持程序的持续运行
- 处理APP中各种事件(触摸、定时器、selector等)
- 节省CPU资源,提高程序性能(让CPU有事情处理时处理,无事时休息)
程序入口Main函数
UIApplicationMain 一直没有返回(int) 相当于一直在死循环,返回0时,程序结束
一个线程对应一个RunLoop(CFRunLoopRef中有源码),RunLoop用字典储存,key为一个线程
RunLoop
程序入口Main函数
UIApplicationMain 一直没有返回(int) 相当于一直在死循环,返回0时,程序结束
一个线程对应一个RunLoop(CFRunLoopRef中有源码),RunLoop用字典储存,key为一个线程