NSScrollView's reflectScrolledClipView: not redrawing content

Discussion in 'Mac Programming' started by Cinder6, Aug 23, 2009.

  1. Cinder6 macrumors 6502

    Cinder6

    Joined:
    Jul 9, 2009
    #1
    I have an NSScrollView with a custom NSView subclass in it (created from IB). It draws just fine, but if I set the content view to scroll to the top, then call the scroll view's reflectScrolledClipView: method, it performs the scroll, but doesn't show the contents of the view. I have to either scroll down slightly, or resize the window.

    I've tried setNeedsDisplay on the NSView subclass itself, the content view, the scroll view, and the document view, all to no effect. Is there something else I need to do?
     
  2. petron macrumors member

    Joined:
    May 22, 2009
    Location:
    Malmo, Sweden
    #2
    I do not know if it helps.

    1. I usually call the setNeedsDisplay every place where I do make any changes on the view.
    2. The setNeedsDisplay has to be called in the same class where we have over written the drawRect method. Other way the redraw will not be executed immediatly.
    3. Try to use debugger and see if the setNeedsDisplay has been called.

    BR
    /petron
     
  3. Cinder6 thread starter macrumors 6502

    Cinder6

    Joined:
    Jul 9, 2009
    #3
    I've confirmed setNeedsDisplay is being called, and I put an NSLog in drawRect: -- it isn't getting called. Even if I call display explicitly, it's still not getting called. How do I force an NSView to display?
     
  4. petron macrumors member

    Joined:
    May 22, 2009
    Location:
    Malmo, Sweden
    #4
    Cinder6,
    Then I do not know how to help, maybe somebody else can step in...

    Good Luck
    /petron
     

Share This Page