2012-01-03 131 views
0

我想要显示两个图像,一个接一个地右对齐;在用户按下“开始”之后。第一幅图像将显示3秒,然后第二幅图像将在右侧显示。每张图像设置为暂停3秒。它符合好了(3G 4.2.1)模拟器上模拟运行时,无论图像的已被注释掉,但是当编码如下第一个图像上挂起:显示一个图像,然后是第二个图像iPhone上的用户Preses“开始”之后的图像

//this method gets called when the start button is pressed 
-(IBAction) start { 

    [self.navigationController pushViewController:self.**halfSplashController** animated:YES]; 

    [self.navigationController pushViewController:self.**halfSplash2Controller** animated:YES]; 
} 

有我需要之间插入一个命令这两个或应该显示第一个图像,然后按照我的设想继续第二个图像?

回答

0

我认为你应该使用NSTimer延迟3秒。试试下面的代码

-(IBAction) start 
{ 
    [self.navigationController pushViewController:self.**halfSplashController** animated:YES]; 

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(theActionMethod) userInfo:nil repeats:NO]; 
    [currentTimer fire]; 
} 


- (void)theActionMethod 
{ 
    [self.navigationController pushViewController:self.**halfSplash2Controller** animated:YES]; 
} 

秒。如果你要反复更改图像,然后更改重复到YES在的NSTimer initialization.And也改变了代码theActionMethod()函数它将改变3后的图像。

+0

的方式。谢谢。 – user1127421 2012-01-04 03:18:30

0

您也可以使用该方法[自performSelector:afterDelay],它应该工作您的解决方案为我工作很好,你想

+0

我不熟悉这种方法,我会检查出来。谢谢。 – user1127421 2012-01-04 03:19:47

相关问题