• 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: Any way to keep on pane of NSSplitView from resizing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to keep on pane of NSSplitView from resizing?


  • Subject: Re: Any way to keep on pane of NSSplitView from resizing?
  • From: Gustavo Pizano <email@hidden>
  • Date: Mon, 28 Dec 2009 11:14:48 +0100

Its not so complicated as it look...

I was having problems also with that... but then I found somewhere on internet how they do it... but they were taking more things into account... I just needed to do what you want.

just declare the Max and min width/height of your left/top view, implement the delegate methods :

- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaxofSubviewAt:(NSInteger)dividerIndex
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinofSubviewAt:(NSInteger)dividerIndex

to return tohse values.

then implement:
- (void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:(NSSize)oldSize
and there check for:
the new size of the sender (splitView)
take the right and left sizes (top/bottom)
get the divider thickness
modify only the right/bottom size width/height  and leave the the left/top width/height to be the new frame size.width /size.height (which you got from splitView parameter).
set the new frames to left and right or top/bottom...


if you make some miscalculation you will get a message in console saying something that the splitview its being redisplayed and recalculated sizes at the cost of performance... if you get that when resizing the window(view) that contains the splitview then you know you did something wrong... if you don't get it.. then  all was ok.

I hope it helps.. Im not expert in cocoa yet.. but this works for me.
G.


On Dec 28, 2009, at 2:30 AM, Rick Mann wrote:

>
> On Dec 27, 2009, at 17:09:18, Andrew Farmer wrote:
>
>> On 27 Dec 2009, at 16:41, Rick Mann wrote:
>>> I have an NSSplitView that divides my window in to two panes (vertically). When the window is resized, I'd like the left pane to keep the width it has, rather than having both panes resizing proportionally. Is this possible?
>>
>> Sure. Even without getting BWToolkit involved, a split view delegate can control what goes where when the view gets resized.
>
> I keep looking for a setting in IB for such things, and don't think to look for a delegate. Bit of a PITA, but it'll do. Thanks!
>
> --
> Rick
>
> _______________________________________________
>
> 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

  • Follow-Ups:
    • Re: Any way to keep on pane of NSSplitView from resizing?
      • From: Ken Ferry <email@hidden>
References: 
 >Any way to keep on pane of NSSplitView from resizing? (From: Rick Mann <email@hidden>)
 >Re: Any way to keep on pane of NSSplitView from resizing? (From: Andrew Farmer <email@hidden>)
 >Re: Any way to keep on pane of NSSplitView from resizing? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Can you get data from the software update PP?
  • Next by Date: Re: Program not working under Snow Leopard
  • Previous by thread: Re: Any way to keep on pane of NSSplitView from resizing?
  • Next by thread: Re: Any way to keep on pane of NSSplitView from resizing?
  • Index(es):
    • Date
    • Thread