当视图控制器的内容未收费时阻止 UITabBarController
我正在做一个使用 TabBarController 的应用程序,每个选项卡都使用自己的导航控制器。
该应用程序具有动态内容,我使用 viewDidDisappear viewDidAppear 方法来创建或销毁每次进入或退出 ViewController 时所需的对象。
我的问题是,当我开始快速航行时,我没有时间加载用于上传内容(例如 XML peta 应用程序)的线程或在离开 ViewController 时销毁对象。
我如何控制导航栏或 tabbarviewcontroller 的选项卡在视图控制器加载所有内容之前不响应?
如果我表达得不好请见谅。谢谢!
I'm doing an app that uses a TabBarController and each Tab uses its own navigation controller.
The app has dynamic content and I use viewDidDisappear viewDidAppear methods to create or destroy the objects that I need each time I enter or exit into the ViewController.
My problem is when I start to sail very fast and I don't give time to load the Threads that I use for uploading content such as XML peta app or destroy objects when I leave the ViewController.
How I could control the tabs of the navigationbar or tabbarviewcontroller for not respond until the viewcontroller has loaded all contents?
Excuse me if I'm not well expressed. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无论您使用同步请求还是异步请求,只需在加载数据时显示一个
UIAlertView
即可。这既会通知用户正在加载某些内容,也会阻止与屏幕上所有其他视图的交互。No matter you use synchronous request or asynchronous request, just show an
UIAlertView
while loading the data. This will both serve as a notification to the user that something is being loaded, and the it will block the interactions with all the other views on the screen.正如其他人在评论中所建议的那样,我相信您想要做的是重新安排事件的触发顺序。也许是这样的:
我真的没有看到任何解决办法——如果 UI 在新内容加载之前无效,那么你必须等待它。
另一种解决方案可能是缓存上次获取的内容,并始终在 viewDidLoad 上显示这些内容。然后,在新内容线程的末尾,缓存新内容并更新 UI。
As others have suggested in comments, I believe that what you want to do is rearrange the order in which things are triggered. Perhaps something like this:
I don't really see any way around this -- if the UI is not valid until the new content is loaded, then you have to wait for it.
Another solution might be to cache the contents from the previous fetch, and always display those on viewDidLoad. Then, at the end of your new-content-thread, cache the new contents, and update the UI.