Interesting. I had forgotten that + textContainer: is the designated initializer.

I think I'll file a bug report on this. Maybe I'll get an answer.

Thanks.

--
Seth Willits




On May 21, 2009, at 4:20 AM, Andy Lee wrote:

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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to