• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get a scroll view to recognize overflow on a custom view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a scroll view to recognize overflow on a custom view?


  • Subject: Re: How to get a scroll view to recognize overflow on a custom view?
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 22 Mar 2009 22:50:13 -0700

On Mar 22, 2009, at 21:12, Ken Tozier wrote:

Hi

I have a custom view inside a scroll view and all works nicely except when the custom view's contents exceeds the depth of the scroll view. The scroll bars don't appear. I created the scroll view in IB from a standard widget and did nothing more than set the class of default content view to my custom class.

I read the NSScrollView docs and the companion "Scroll View Programming Guide for Cocoa" and notice that neither the contentView nor the documentView are available from inside IB. I looked at the different IB data views with scroll bars, checking what their outlets are and tried setting mine up the same, but they must be doing something behind the scenes.

What do I need to do to get the scroll view to notice when my custom view exceeds it's depth?

The "document view" *is* available from inside IB. It's the same thing as what you called the "default content view". IB only suppresses explicit display of the clip view.


If scroll bars don't appear, there are 2 likely causes:

-- You are failing to set your custom view's "depth" properly. The depth is determined by your custom view's frame. Make sure you're setting the frame to the correct height (and not, for example, setting just the bounds to the desired height).

-- The autoresize flags for your custom view are causing it to be resized because the enclosing scroll view is being resized as part of the window setup. If you want to control the view frame height yourself, make sure the vertical autoresize widget for the custom view in IB is not set to change the view height. You may want to also turn off the scroll view's "resizes subviews automatically", unless you want the width of your view to match the scroll view automatically.

Note that the non-appearance of the scroll bar most likely results from the above in combination with the "hides scroll bars automatically" option for the scroll view in IB. If you uncheck that, you should see the scroll bar, but the scroll bar would then be inactive if you don't maintain the view height correctly.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to get a scroll view to recognize overflow on a custom view?
      • From: Ken Tozier <email@hidden>
References: 
 >How to get a scroll view to recognize overflow on a custom view? (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: How to get a scroll view to recognize overflow on a custom view?
  • Next by Date: Creating UI for as of Get Info Panel
  • Previous by thread: Re: How to get a scroll view to recognize overflow on a custom view?
  • Next by thread: Re: How to get a scroll view to recognize overflow on a custom view?
  • Index(es):
    • Date
    • Thread