-1
我无法弄清楚如何做到这一点:做两个步骤 - 一个接一个
我有一个ImageView的,并通过单击我想在ImageView的按钮显示:第一个图像,然后等待几秒钟,并做一些while循环,它会找到第二个图像(通过遵循while循环中的许多其他图像中的指令),然后显示所选的(第二个)图像。
我不知道我描述了我的问题很清楚,所以这里是示例代码:
- (IBAction)button:(id)sender {
i=0;
UIImage *img = [UIImage imageNamed:@"image1.png"];
[first setImage:img];
/*some code which sets the time the image1 stay shown*/
while (i<some_variable) {
/*blah blah blah*/
if (something) {UIImage *img = [UIImage imageNamed:@"image2.png"];
[first setImage:img];}
if (something else) {UIImage *img = [UIImage imageNamed:@"image3.png"];
[first setImage:img];}
...
/*code code code*/
i++;
}
}
这其中并没有解决我的问题:
[NSThread sleepForTimeInterval:1.0];
它只是等待的空白然后处理代码并显示所选图像。
这应该是非常基本的东西,我想不出任何想法。
performSelector:withDelay: –
我抬起头来对一些主题在这里和在谷歌这个,但我不知道如何使用它。你能把这个应用到我的代码中吗? – TomasJ