执行结果解析: [self performSelector:@selector(test1) withObject:nil afterDelay:.0];
[self test3];
打印结果是1,3,2
为什么2会后打印而不是同时打印.
因为当执行到[self performSelector:@selector(test1) withObject:nil afterDelay:.0];时才创建的timer, 才加入到runloop, 他第一次执行只能是runloop的下一次循环,也就是下一次被唤醒后才会执行他, 本次循环不会执行

网友评论