好久没用过runloop那些东西,好多东西都忘了
run方法开启一个无限循环,在这个循环里监听和处理消息,相当于:
while(1) {
[runloop runMode:beforeDate:]
}
文档一句话:
otherwise, it runs the receiver in theNSDefaultRunLoopMode by repeatedly invokingrunMode:beforeDate:.
所以,当使用run方法的时候,不需要再写for或者while循环,使用runMode:beforeDate:的时候需要。
网友评论