Posted By

iloveitaly on 05/19/07


Tagged

word wrapping categorie NSTextView


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

ericj
strangesthings


Disable Word Wrapping in NSTextView


 / Published in: Objective C
 

  1. #import "NSTextView+Wrapping.h"
  2.  
  3. // references:
  4. // http://developer.apple.com/documentation/Cocoa/Conceptual/TextUILayer/Tasks/TextInScrollView.html#//apple_ref/doc/uid/20000938-164652-BCIDFBBH
  5. // http://www.cocoabuilder.com/archive/message/cocoa/2003/12/28/89458
  6.  
  7.  
  8. @implementation NSTextView (Wrapping)
  9. - (void) setWrapsText:(BOOL)wraps {
  10. if(wraps) {
  11. // implement later
  12. } else {
  13. NSSize bigSize = NSMakeSize(FLT_MAX, FLT_MAX);
  14.  
  15. [[self enclosingScrollView] setHasHorizontalScroller:YES];
  16. [self setHorizontallyResizable:YES];
  17. [self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
  18.  
  19. [[self textContainer] setContainerSize:bigSize];
  20. [[self textContainer] setWidthTracksTextView:NO];
  21. }
  22. }
  23. @end

Report this snippet  

You need to login to post a comment.