• 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: Expanding NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Expanding NSScrollView


  • Subject: Re: Expanding NSScrollView
  • From: Andrew Shamel <email@hidden>
  • Date: Sun, 26 Jul 2009 10:11:25 -0600

Thanks so much for your help! I got this to work beautifully, the only problem is that I can't now get the scrollview (or its enclosing view, etc.) to shrink back when the text/rows get shorter, since the frame of the documentView does not seem to get smaller as the text recedes (I haven't tried it with a table yet). The notification stops being sent, since the documentView and contentView seem to stop changing size.

Any thoughts?

Thanks again.

Peace,

Andy Shamel



On 21 Jul 2009, at 3:51 PM, Quincey Morris wrote:

Ack! That seems far too complicated.

You can have your window controller (or whatever equivalent controller you're using) register via 'addObserver:selector:name:object:' to be notified when the NSTextView or NSTableView frame changes. (Note that you have to call 'setPostsFrameChangedNotifications:YES' on those views to be able to get these notifications.)

When you get a notification, compare the frame of the NSTextView or NSTableView with the bounds of the scroll view's clip view (the documentView frame and the clipView bounds are in the same coordinate system) to determine whether the clip view is too big, too small or just right.

If the clip view is the wrong size, you need to resize the view containing the scroll view (so that the things adjacent to the scroll view move out of its way) by the amount that the clip view is wrong. Autoresizing should then trickle down and produce the results you want.

There are a few things to be careful of:

-- resizing view while you're in the notification handler method may cause additional notifications, and you need to handle that

-- if you want the number of line/rows to change for other reasons (e.g. when you resize the window), you might have to observe the clip view frame too

-- if you have autohiding vertical scroll bars on you NSTextView or NSTableView, you may end up in a situation where the scroll view size change "bounces" up and down, and you need to handle that

HTH

_______________________________________________

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


References: 
 >Expanding NSScrollView (From: Andrew Shamel <email@hidden>)
 >Re: Expanding NSScrollView (From: Quincey Morris <email@hidden>)
 >Re: Expanding NSScrollView (From: Andrew Shamel <email@hidden>)
 >Re: Expanding NSScrollView (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Display csv in a tableView with bindings
  • Next by Date: Re: How do I extract the int value from an xml node/element?
  • Previous by thread: Re: Expanding NSScrollView
  • Next by thread: SecRandom.h on iPhone OS 2.2.1?
  • Index(es):
    • Date
    • Thread