PDA

View Full Version : UITabBarController not working as expected




fishkorp
Sep 2, 2008, 09:47 PM
So I have an app that's using a tab bar controller and it's not behaving like I think it should, unless this is the proper behavior. I have 3 tabs. When the app first loads I display a loading message while I fetch data to populate a table. Once all the data is retrieved the loading message and spinning wheel are released and I load the data. Now, when I go to a different tab and then switch back, I'd expect to get the loading screen again since I call it in the viewWillAppear. However, it hangs on the tab I'm leaving, fetches all the data, then switches to the first tab with the table already populated. What do I need to do to get it to switch first, display the loading screen, then fetch/populate? Is it a delegate method I'm missing? Some simple property? Thanks for any help.



Luke Redpath
Sep 3, 2008, 02:13 AM
How are you fetching your data? If you are doing it synchronously that will cause your UI to hang.

fishkorp
Sep 3, 2008, 09:16 AM
I'm using an NSXMLParser initWithContentsOfURL method. I haven't seen anything on that as synchronous vs. asynchronous. I suppose if it's a huge deal I can switch to JSON.

*edit*
I tried initWithData, which I'm getting using an asynchronous NSURLConnection, but it still waits before the transition.