Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

ViewController called before applicationDidFinishLaunching?

bugnotebugnote Posts: 183Registered Users
edited August 2009 in iPhone SDK Development
hopefully this is a simple one to solve, but it has me stumped, my app gives the user an option to grab certain data from the addressbook to partially complete an SQL database at app start time.

i've added a uialertview and progressview window which works quite nicely.

its a tab bar controller and the root tabs view controller is already loaded before the alertview code has had a chance to be run.

I thought that the entire applicationdidfinishlaunching method was run through before the relevant viewcontroller took over?

if not, this may be a fix.....is there a way to re-run viewdidappear/load when the alertview has been dismissed to re-run the code within it...? this would fix my problem as viewdidload just queries the SQLite database to re-populate the array I have in there.

cheers

Bug
Post edited by bugnote on
<b><a href="http://www.burnsoft.co.uk" target="_blank">Burnsoft Ltd.</a></b> Apps for your iOS device.

Replies

  • lbendlinlbendlin Posts: 429Registered Users
    edited February 2009
    You can call viewDidLoad as often as you want. I am even doing it from another viewcontroller. Just make sure your object allocations are balanced.
  • bugnotebugnote Posts: 183Registered Users
    edited February 2009
    thanks, will look into that..

    am curious though as to why my initial view is being called before appdidfinishlaunching?

    anyone had this problem before?

    cheers

    Bug
    <b><a href="http://www.burnsoft.co.uk" target="_blank">Burnsoft Ltd.</a></b> Apps for your iOS device.
  • jrrljrrl Posts: 10Registered Users
    edited February 2009
    bugnote wrote: »
    am curious though as to why my initial view is being called before appdidfinishlaunching?

    anyone had this problem before?

    I just ran into this one myself and think I've figured it out. When ApplicationDidFinishLaunching does this:
    [window addSubview:[self.viewController view]];
    

    it seems to trigger the view's ViewDidLoad. My solution for the moment is just to move that line to after all my tweaks to ApplicationDidFinishLaunching. If you are doing more interesting things in ApplicationDidFinishLaunching, perhaps this not the best solution. I am just loading some plists, so it doesn't cause me any problems.

    An alternative, I suppose, would be for ApplicationDidFinishLaunching to call ViewDidLoad (or some other method) just before it does the MakeKeyAndVisible call.

    Does this make any sense?

    -John.
  • bwalrondbwalrond Posts: 1New Users
    edited August 2009
    I have been experiencing the same issue whereby viewDidLoad is called before applicationDidFinishLaunching.

    I'm not certain yet, but I think it has to do with how the nib files are configured to point to which file owners. Hopefully, this is a clue that can point you in the right direction.

    Still working on it.

    Bill
Sign In or Register to comment.