我有一个 PlayPageViewController 作为 rootViewController
。 PlayPageViewController 将在方法调用 editPages() 中显示 3D 模型和 UIImages
,这将需要等待几秒钟。
我只想在开始时添加一个 loadingView,当 PlayPageViewController 完全加载后它就会消失。
这是我的解决方案:
- 添加一个带有 activityIndicator 的 loadingView。
- 当loadingView加载完成后,我就开始执行
但好像没用
STLoadingViewController *loadingView =
[[STLoadingViewController alloc]initWithNibName:@"STLoadingViewController"
bundle:nil];
loadingView.view.frame=CGRectMake(0, 0, 1024, 768);
[self.view insertSubview:loadingView.view atIndex:3];
if(loadingView.isViewLoaded && loadingView.view.window)
{
[self.view insertSubview:self.playPageViewController.view atIndex:4];
[self.playPageViewController setEditingPage:pageIndex];
[loadingView.view removeFromSuperview];
}
最佳答案
当调用此方法时,您必须执行各自的方法来调用 viewDidAppear
方法,所有出现的任务都已完成。
关于IOS,当 UIView 完全加载时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17875456/