splitView not rendering correctly - where am I wrong ?
splitView not rendering correctly - where am I wrong ?
- Subject: splitView not rendering correctly - where am I wrong ?
- From: Mario KuĆĄnjer <email@hidden>
- Date: Thu, 16 Jul 2009 16:55:54 +0200
- Thread-topic: splitView not rendering correctly - where am I wrong ?
Hello everyone!
So I have a little problem that I don't know how to fix so if somebody
would be kind to help and explain the solution.
Problem is that splitView displays subviews that are rendered outside from the visible area
of the window so therefore are clipped (not visible). They are clipped after the splitView
has been resized in that extend that (only right subview and/or both) subviews had been totally sized down.
When resized back up, top (of both subviews) and/or right part (of right subview) are clipped.
My guess it has something to do with bounds and/or position of subviews, but since I'm novice in Cocoa
and Objective-C I can't see the solution.
Here is the code that I'm using for displaying splitView.
Thanks in advance!
Mario
----------------------------------------------------------------------------------------------------------------------------------
- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize
{
NSView *leftView = [[sender subviews] objectAtIndex:0];
NSView *rightView = [[sender subviews] objectAtIndex:1];
float dividerThickness = [sender dividerThickness];
NSRect splitViewFrame = [sender frame];
NSRect leftFrame = [leftView frame];
NSRect rightFrame = [rightView frame];
int differenceInWidth = splitViewFrame.size.width - oldSize.width;
leftFrame.size.height = newFrame.size.height;
leftFrame.origin = newFrame.origin;
if (differenceInWidth < 0)
{
rightFrame.size.width += differenceInWidth;
}
else if (differenceInWidth > 0)
{
rightFrame.size.width += differenceInWidth;
}
rightFrame.size.width = splitViewFrame.size.width - leftFrame.size.width - dividerThickness;
rightFrame.size.height = newFrame.size.height;
rightFrame.origin.x = newFrame.origin.x + leftFrame.size.width + dividerThickness;
[leftView setFrame:leftFrame];
[rightView setFrame:rightFrame];
[sender adjustSubviews];
[sender display];
}
_______________________________________________
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