Delayed code

Discussion in 'iOS Development' started by andydam123, Aug 11, 2010.

  1. andydam123

    andydam123 Member

    Joined:
    Aug 11, 2008
    Messages:
    447
    Likes Received:
    0
    I'm wondering how I can run something AFTER the UI and stuff are fully drawn out.

    In viewDidLoad, etc, they all run while the app is still starting up, and the UI only shows up after its done running.
  2. SpeedyApocalypse

    SpeedyApocalypse Member

    Joined:
    Dec 27, 2009
    Messages:
    564
    Likes Received:
    13
    Device:
    4G iPod touch
    Measure the amount of time that it takes for the UI to load, then just call the method that you want to run with a timer.
  3. Just_For_Now

    Just_For_Now Active Member

    Joined:
    Mar 21, 2009
    Messages:
    1,898
    Likes Received:
    1
    Device:
    4G iPod touch
    Fire a timer in the viewDidLoad.

    [OBJC]
    -(void)viewDidLoad{
    [self performSelector

    Please Register or Log in to view images

    selector(timerDone) withObject:nil afterDelay:5.0f];
    }
    [/OBJC]
  4. Jeepston

    Jeepston New Member

    Joined:
    May 17, 2009
    Messages:
    45
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Did you try

    - (void)viewDidAppear

    Please Register or Log in to view images

    BOOL)animated

    method?
  5. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    Not all devices will show the UI at the exact same speed, that's just useless coding. viewDidAppear will work in this case (as said above).

Share This Page