• 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
[SOLVED] vertically resize NSTextField frame
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] vertically resize NSTextField frame


  • Subject: [SOLVED] vertically resize NSTextField frame
  • From: Stuart Malin <email@hidden>
  • Date: Mon, 21 Apr 2008 19:19:11 -1000

After poking around some more, I came up with this approach, which seems to work
(except that I now have to deal with adjusting the text field's origin):


NSRect r = NSMakeRect(0, 0, [theTextField frame].size.width, MAXFLOAT);
NSSize s = [[theTextField cell] cellSizeForBounds:r];
[theTextField setFrameSize:s];


If there is a better way to be doing this, please advise.


On Apr 21, 2008, at 6:06 PM, email@hidden wrote:

Message: 16
Date: Mon, 21 Apr 2008 18:03:30 -1000
From: Stuart Malin <email@hidden>
Subject: vertically resize NSTextField frame
To: Cocoa Developer List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I have an NSTextField into which I pour some text. I'd like to resize
the text field's frame to accommodate the typeset text. I'd like to
adjust only the frame's vertical size, leaving the width fixed. I'd
appreciate any pointers about what methods I can use to accomplish this.

_______________________________________________

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


  • Follow-Ups:
    • Re: [SOLVED] vertically resize NSTextField frame
      • From: Rob Napier <email@hidden>
  • Prev by Date: Re: Flicker when resizing NSStatusItem with Custom View
  • Next by Date: NSCollectionView and CoreData question
  • Previous by thread: Re: Truncated Table Headers
  • Next by thread: Re: [SOLVED] vertically resize NSTextField frame
  • Index(es):
    • Date
    • Thread