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

Whitespace


  • Subject: Whitespace
  • From: "I. Savant" <email@hidden>
  • Date: Thu, 4 May 2006 15:56:05 -0400

List:

I am trying to add whitespace to the end of an NSTextView enclosed in an NSScrollview. I am attempting to keep the text at the end of the view from being at the bottom of the screen while the user is typing.

I figured the best way to do this is to override NSTextView's - sizeToFit and add some padding to the height. Since the view is flipped, I expected some extra whitespace to appear beneath the last line of text.

  I added this to my NSTextView subclass:

- (void)sizeToFit
{
   // Call super
   [super sizeToFit];

   // Adjust height to add some space
   NSRect frame = [self frame];
   frame.size.height += 100;
   [self setFrame:frame];
}

It's not working, though. It *seemed* pretty clear-cut. ;-) I have verified via NSLog() that the method is being called. Unfortunately there doesn't seem to be any change in the text view at runtime.

I imagined the NSTextContainer's -heightTracksTextView might have something to do with it, but toggling it only broke the scrolling. I still suspect I may need to mess around with that a bit (set it to NO and handle the sizing manually), but I'm not sure if this is the best approach and wanted your opinions first.

More than likely I'm missing something ridiculously obvious here. Any suggestions would be greatly appreciated.

--
I.S.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Hiding find panel in NSTextView
  • Next by Date: Re: NSUserDefaults and using volatile domains
  • Previous by thread: NSTextView setNeedsDisplayInRect:avoidAdditionalLayout:
  • Next by thread: Using NSUserDefaultsController in a plugin
  • Index(es):
    • Date
    • Thread