what causes a view to not show when added as a subview?

Discussion in 'iOS Programming' started by Chirone, Jan 25, 2010.

  1. Chirone macrumors 6502

    Joined:
    Mar 2, 2009
    Location:
    NZ
    #1
    i have a scroll view and on that scroll view i can add uibuttons and uiimageviews fine using the addSubview method

    then when i create an instance of a subclass of UIViewController and add that view to it the view loads but it doesn't show
    the viewWillAppear: method doesn't even get called but the viewDidLoad: method does

    how is it possible for a view to be added to another view and not show up?
     
  2. ghayenga macrumors regular

    Joined:
    Jun 18, 2008
    #2
    It's hidden, it's off the screen, it's nil.

    Without a code sample all we could do is guess wildly.
     
  3. Chirone thread starter macrumors 6502

    Joined:
    Mar 2, 2009
    Location:
    NZ
    #3
    well, wild guesses are better than none

    turns out the frame rectangle was a zero rect

    such faults take up so much time to figure out and then you find out that you just needed to insert one line of code... *sigh* :rolleyes:
     
  4. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #4
    It will also not show if the frame has not been set.
     

Share This Page