【发布时间】:2013-07-26 07:30:29
【问题描述】:
我有一个 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];
}
【问题讨论】:
-
您能添加更多上下文吗?上面的代码在哪里执行?您是在后台还是在主线程中加载模型?你的视图控制器的设置到底是什么样的? Apple 建议显示占位符图像并在后台加载内容,以确保您的应用始终响应。
-
1.上面的代码在rootViewController的ViewLoad()中执行2.我想我在主线程中加载了模型,为什么它会持续几秒钟。3。我的 viewController 的设置只是新的图像视图、模型视图并将它们添加到 self.view 中,就是这样。顺便说一句,我如何在背景中加载模型
标签: ios objective-c addsubview