gpt4 book ai didi

ios - 循环不会像我希望的那样在 objective-c 中更改标签

转载 作者:太空宇宙 更新时间:2023-11-04 02:55:15 24 4
gpt4 key购买 nike

<分区>

我只是在 xcode 上玩弄 objective c,这似乎是一个愚蠢的问题,但这是我的代码块,它可以工作,但不能按我想要的方式工作。

        int i = 10;
int x = 0;
do {

printf("Count is: %i\n", x);
NSString *Result = [[NSString alloc] initWithFormat: @"%i", x];
counting.text = Result;
x++;
usleep(1000000);
} while (x < i);

它只在循环结束时将标签更改为 9,它可以正常打印到控制台,但它应该从 0 计数到 9 并在应用程序上显示。我想我需要做多线程,但是示例是用 java 编写的,所以我不能将它们应用于这种语言

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com