NSTextField waits until the end of a loop to update

前端 未结 4 1427
礼貌的吻别
礼貌的吻别 2020-11-27 20:52

Here\'s the problem: I have some code that goes like this

otherWinController = [[NotificationWindowController alloc] init];
for (int i = 0; i < 10; i++)          


        
4条回答
  •  庸人自扰
    2020-11-27 21:25

    You can probably achieve the desired effect right inside your loop, if you explicitly give the run loop some time to run:

    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow: 0.1]];
    

提交回复
热议问题