• 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: splitView not rendering correctly - where am I wrong ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: splitView not rendering correctly - where am I wrong ?


  • Subject: Re: splitView not rendering correctly - where am I wrong ?
  • From: Boyd Collier <email@hidden>
  • Date: Thu, 16 Jul 2009 09:36:57 -0700

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 (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


References: 
 >splitView not rendering correctly - where am I wrong ? (From: Mario Kušnjer <email@hidden>)

  • Prev by Date: Re: Problems displaying an image in UIWebView
  • Next by Date: Re: Problems displaying an image in UIWebView
  • Previous by thread: Re: splitView not rendering correctly - where am I wrong ?
  • Next by thread: Problems displaying an image in UIWebView
  • Index(es):
    • Date
    • Thread