UITabBarController not working as expected

Discussion in 'iPhone/iPad Programming' started by fishkorp, Sep 2, 2008.

  1. macrumors demi-god

    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.
  2. macrumors 6502a

    How are you fetching your data? If you are doing it synchronously that will cause your UI to hang.
  3. macrumors demi-god

    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.

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

Share This Page