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