• 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
Re: NSTextView - Having to call setFrame twice to work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView - Having to call setFrame twice to work?


  • Subject: Re: NSTextView - Having to call setFrame twice to work?
  • From: Andy Lee <email@hidden>
  • Date: Thu, 21 May 2009 07:20:02 -0400

I get the same result using initWithFrame:, but if I use the designated initializer it works as expected:

textView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, 400, 300) textContainer:nil];

The docs says that initWithFrame: creates a text container, so the difference seems to be whether the text view has a text container. I don't understand exactly why this causes setFrame: to behave the way it does -- maybe someone else can shed light on this.

Note that sometimes setFrame: does set the frame to the size you give it -- for example, if you start with 400x900 and go to 500x800.

--Andy


On May 21, 2009, at 12:47 AM, Seth Willits wrote:

This is as simple as it gets...

textView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, 400, 300)];

// [textView frame] is {0, 0, 400, 300}

[textView setFrame:NSMakeRect(100, 100, 500, 400)];

// [textView frame] is {100, 100, 500, 300}

[textView setFrame:NSMakeRect(100, 100, 500, 400)];

// [textView frame] is {100, 100, 500, 400}


What gives?


-- Seth Willits



_______________________________________________

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

_______________________________________________

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: NSTextView - Having to call setFrame twice to work?
      • From: Seth Willits <email@hidden>
References: 
 >NSTextView - Having to call setFrame twice to work? (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Sensible way to extend base class?
  • Next by Date: Re: Privilege elevation of a cocoa app
  • Previous by thread: NSTextView - Having to call setFrame twice to work?
  • Next by thread: Re: NSTextView - Having to call setFrame twice to work?
  • Index(es):
    • Date
    • Thread