为 Monotouch 应用程序创建加载屏幕类的最佳方法是什么?
在我的应用程序启动之前,我需要加载和处理很多事情,所以当我在 iPhone 上测试它时,它总是被 iOS 杀死,因为它挂起 iPhone 的时间太长了。
然后我决定为我的应用程序编写一个加载屏幕类,它可以立即显示徽标和进度指示器(保持响应以避免被 iOS 杀死),同时在后台有一个单独的线程初始化我的所有 ViewController,然后关闭加载屏幕并显示主窗口。
使用 MonoTouch 实现此目的的最佳方法是什么?
欢迎任何建议。 谢谢。
I need to load and process many things before my app starts, so when I test it on my iPhone it's always killed by iOS because it hangs the iPhone for too much time.
I then decided to write a loading screen class for my Apps, something that shows immediatly a logo and a progress indicator (keeping it responsive to avoid being killed by iOS), while in a background a separate thread initializes all my ViewControllers and then closes the loading screen and shows the main window.
What is the best way to do it with MonoTouch?
Any suggestion is welcome.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是这样做的:
在 FinishedLaunching 方法中,初始化初始视图并将其添加到主窗口:
之后,调用您的代码来执行您想要在线程/异步调用中执行的所有操作。我通常使用线程池。记住在主线程上调用:
一个粗略的例子,但我希望它有帮助。
This is how I do it:
In the FinishedLaunching method, initialize and add your splash view to the main window:
After that, invoke your code that does all the stuff you want to do in a thread/async invocation. I usually use the ThreadPool. Remember to invoke on the main thread:
A rough example, but I hope it helps.