How to start something after view has loaded

Discussion in 'iOS Development' started by cybohemia, Mar 3, 2009.

  1. cybohemia

    cybohemia New Member

    Joined:
    Jan 25, 2009
    Messages:
    49
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    I'm trying to trigger a function call immediately after the view has loaded.

    I noticed that subviews with textviews will not show the text if they are initially placed in their parent view outside of the parents' bounds. (I had posted about this yesterday.) My hacky solution is to post it within the bounds and then to move it.

    I don't want the user to see the pre-moved positions so I'd like to take care of it at the beginning of the view being created but putting the move code in viewDidLoad or viewDidAppear didn't do the trick.

    Putting a timer in viewDidAppear did work.

    So, I'm guessing there's some more overhead stuff that goes on during that time? Maybe the call stack needs to be cleared so calls completed from within viewDidAppear won't do it and I'll just have to use the timer hack...

    Any thoughts?

    Thanks!
  2. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    You should be able to do this using

    Code:
    - (void)viewDidLoad {
            [super viewDidLoad];
            // Your code here
    }

Share This Page