views:

34

answers:

1

Basically my app loads two RSS feeds - a blog feed and a twitter stream. These are in two different views in a tab bar controller. There is also a Home view which is the default view when the application launches.

Ok, so basically when you go from the Home tab to the blog or twitter tab then it takes a while to load. Fair enough, its trying to download everything off the internet.

My question is, while the user is on the home page is there any way of "preloading" the other views so that the viewDidAppear function is already run?

Or, maybe a way of having a "loading" screen, because at the moment it seems like the application has just crashed when you click on a tab, the tab doesn't even highlight until it has loaded the view.

Thanks a lot guys.

+2  A: 

IMO it's not a good idea to preload the views themselves. But it might make sense to preload the data from the home screen (at least when you're connected to WiFi). To do that, decouple the loading code from the view, e.g. by moving it to a separate model class.

In general, you should implement all your network connections asynchronously to avoid freezing the UI during these operations.

Ole Begemann
hmm, that might be a good idea... :) thank you, will try it. :)
Thomas Clayson
I'm not sure I understand... I've tried what I thought you meant, but it hasn't really gone very well haha.I've put all the stuff in my app delegate now and the app takes a while to load, but everythings loaded by the time it starts up... but I'm worried about people on edge or without an internet connection... what will they do? I mean the app is pretty much useless without an internet connection, but the slow loading is bothering me.
Thomas Clayson
Search for NSURLConnection. That class makes it possible to load data from the web **a**synchronously, meaning that the UI/thread won't block when it's loading :).
Tim van Elsloo
ah thank you :)
Thomas Clayson