RunLoop理解

What's Run Loops?

Why Run Loops?

命令行式执行

int main(int argc, char * argv[]){
    NSLog(@"Hello world!");
    return 0;
}

Event驱动

int main(int argc, char * argv[]){
    while(AppIsRunning){
        id whoMakeMe = SleepForMakingUp();
        id event = GetEvent(whoMakeMe);
        HandleEvent(event);
    }
    return 0;   
}

你可能感兴趣的:(RunLoop理解)