[Solved] Re: loaded subview not expanding correctly.
[Solved] Re: loaded subview not expanding correctly.
- Subject: [Solved] Re: loaded subview not expanding correctly.
- From: Chris Schmitt <email@hidden>
- Date: Mon, 28 Jan 2008 15:29:21 -0500
I have solved my problem. When I was binding the view to the
superview I was using the superview's frame. Since I was using an
NSSplitView the view to which I was binding (the right frame) was
offset on the x axis by the width of the left frame. So instead of
passing the superview's frame to the subview's setFrame method I
passed the superview bounds and everything worked.
I am not sure if this is the correct way to do it, so if there is a
better way, please let me know.. but this works so now I can move onto
the next problem.
Joar, thanks again for the log example, that really helped me figure
it out.
On Jan 28, 2008, at 3:09 PM, Chris Schmitt wrote:
Joar, I took your advice and I am still having problems. Here is
the output from the command you suggested:
Superview: {{0, 0}, {702, 413}}, New Frame: {{0, 0}, {690, 297}}, Is
Inside: 1
I can tell that the view is resizing correctly.. If I stretch out to
the right it works, and if I stretch vertically it works. The only
thing that is strange is that there seems to be a let margin.. One
thing to note is the superview is a panel within the scroll view.
Could that make a difference?
Thanks again for your help.
On Jan 26, 2008, at 12:09 AM, j o a r wrote:
On Jan 25, 2008, at 8:19 PM, Chris Schmitt wrote:
My view is loading fine, but my problem is in it's position. The
subview is loading into the center of the superview and clipping
the right side. I have set the autosizers to take up the whole
panel and when I resize the window the subview does look like it
is resizing, but there is still a gap on the left hand side.
The view autosizing machinery only works if you have given the
subview a correct frame to begin with. I would suggest that you
start with verifying that the frame that you assign your subview is
what you think it is. You could try something like this:
NSLog(@"Superview: %@, New Frame: %@, Is Inside: %d",
NSStringFromRect([[theView superview] bounds]),
NSStringFromRect(newFrame), NSContainsRect([[theView superview]
bounds], newFrame));
j o a r
_______________________________________________
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