Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 延迟显示子视图_Iphone - Fatal编程技术网

Iphone 延迟显示子视图

Iphone 延迟显示子视图,iphone,Iphone,当执行此操作时,它会直接显示secondviewcontroller我想要的是viewcontroller首先显示,然后在40或50秒后,它会显示secondviewcontroller next,依此类推 - (void)displayviewsAction:(id)sender { PageOneViewController *viewController = [[PageOneViewController alloc] init]; viewController.view.frame =

当执行此操作时,它会直接显示secondviewcontroller我想要的是viewcontroller首先显示,然后在40或50秒后,它会显示secondviewcontroller next,依此类推

- (void)displayviewsAction:(id)sender
{
PageOneViewController *viewController = [[PageOneViewController alloc] init];

viewController.view.frame = CGRectMake(0, 0, 320, 480);

SecondViewController *secondController = [[SecondViewController alloc] init];

secondController.view.frame = CGRectMake(0, 0, 320, 480);

[self.view addSubview:viewController.view];

[self.view addSubview:secondController.view]; 

[self.view bringSubviewToFront:viewController.view];

[self.view addSubview:toolbar];

[self.view sendSubviewToBack:viewController.view];

[self.view addSubview:toolbar];

}

任何人都知道我如何做到这一点。

您可以在单独的方法中添加secondViewController,并使用


您可以在单独的方法中添加secondViewController,并使用


Aravindhanavilless详述的方法的另一个替代/补充是使用NSTimer:

self.myTimer = [NSTimer scheduledTimerWithTimeInterval:40 target:self selector:@selector(showSecondViewController) userInfo:nil repeats:NO];

Aravindhanavilless详述的方法的另一个替代/补充是使用NSTimer:

self.myTimer = [NSTimer scheduledTimerWithTimeInterval:40 target:self selector:@selector(showSecondViewController) userInfo:nil repeats:NO];

尝试使视图不可见,然后在40秒后快速淡入

secondController.view.alpha = 0.0;
[self.view addSubview:secondController.view];
[UIView animateWithDuration:0.5
            delay:40 
            options:UIViewAnimationCurveEaseInOut 
            animations:^{
                secondController.view.alpha = 1.0;
            }
            completion:NULL
];

尝试使视图不可见,然后在40秒后快速淡入

secondController.view.alpha = 0.0;
[self.view addSubview:secondController.view];
[UIView animateWithDuration:0.5
            delay:40 
            options:UIViewAnimationCurveEaseInOut 
            animations:^{
                secondController.view.alpha = 1.0;
            }
            completion:NULL
];