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

Auto-resizing NSTextField


  • Subject: Auto-resizing NSTextField
  • From: Nik Youdale <email@hidden>
  • Date: Fri, 23 Dec 2005 17:41:15 +1100

Hi,

I have made a custom view which just consists of an NSView subclass, that displays a coloured background, and then an NSTextView in the middle. I would like the TextView to always be just the right size to fit in the text that it contains. So basically when you type, it grows and when you delete, it shrinks (horizontally) I will then need to pass this size on to the NSView to resize that as well.

I tried using [textView sizeToFit] but got no results. Also, the text must also occupy only one line at all times, and it should not be able to scroll or wrap.

If there is a simple method that i need i need to call that would be great, but also if it involves running a check to see how many pixels on screen the text occupies, and then resizing the textView and the NSView every keystroke programatically that is also just fine.

Any help would be greatly appreciated!

Merry Christmas everyone!

- Nik
_______________________________________________
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
  • Follow-Ups:
    • Re: Auto-resizing NSTextField
      • From: Ryan Stevens <email@hidden>
  • Prev by Date: Keyboard Localizations
  • Next by Date: Image Name retrival from web page - Objective C
  • Previous by thread: Re: Keyboard Localizations
  • Next by thread: Re: Auto-resizing NSTextField
  • Index(es):
    • Date
    • Thread