1.如何让一段代码只运行一次:
dispatch_once_t once;
for (int i = 0 ; i < 10 ; i++) {
dispatch_once(&once, ^{
NSLog(@"哪怕在for循环中,我也就用打一次");
});
}