Textview text getting cut off by subview - bug or feature?

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

  1. cybohemia

    cybohemia New Member

    Joined:
    Jan 25, 2009
    Messages:
    49
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    I have a subview within which I'm adding a number of "myviews" that include labels and textviews.

    The problem is, if the textviews that start outside of the bounds of the subview, then they do not show their text. Strangely, this doesn't affect the labels - see the image, below:

    Please Register or Log in to view images



    I intend to clip things outside the subview and then scroll the myviews in the subview but the ones that start outside the subview do not show any text even after they scroll into view.

    I've spent the whole day tracking down the cause of this and now that I figured out when it happens, I'm not sure if this is a bug or a feature...

    Please Register or Log in to view images



    I wonder if anyone can think of anything I can do to ensure the text shows up.

    I've posted the sourcecode for the test that generated the image at http://www.cybohemia.com/iphone/forums/TextviewBug.zip

    Thanks!
    ------------------double post merged------------------
    I made some progress: if I load all the myviews within the subview (so that the text show in the textview) and then move them, the text remains. The problem is, I'm not sure how to automate the move. It works when I put a button on the page that does the work-around. But, when I move the code to viewDidLoad or viewDidAppear, it doesn't work. It seems like I need to invoke a routine after the view is completely loaded (which I thought was what viewDidAppear was but I guess I'm off).

    I tried it with a timer in viewDidAppear and that worked but I'd like to find a solution that's a bit cleaner than using a timer, which seems super-hacky rather than just hacky.

    Any ideas?

    Thanks!
  2. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    I always wonder about setNeedsDisplay for this.

Share This Page