Disable Word Wrapping in NSTextView


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.