Hi Mario,

Just want to add a short note to what Graham Cox said about using Interface Builder. Be sure to read the section "Setting a View's Autosizing Behavior" in Interface Builder User Guide and take some time to experiment with setting springs and struts for various views and subviews. You can make a window with split views containing scroll views, etc. and try out your settings with Simulate Interface, which is on IB's file menu. You don't even need to have Xcode running to do this. It's a bit confusing at first (at least it was for me), but once you see how it works, it will all make sense.

Boyd


On Jul 16, 2009, at 7:55 AM, Mario Kušnjer wrote:

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 (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/bcollier%40sunstroke.sdsu.edu

This email sent to bcoll...@sunstroke.sdsu.edu


_______________________________________________

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