• 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: Stop NSSplitView from resizing with Window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stop NSSplitView from resizing with Window?


  • Subject: Re: Stop NSSplitView from resizing with Window?
  • From: Conor Dearden <email@hidden>
  • Date: Fri, 13 Oct 2006 10:56:22 +0200

What Nick Zitzmann said is correct. Here is the code to make your life
easier. This is for a horizontal orientation, that you mentioned you were
looking for. (Just watch out that the divider thickness is set to 1, the
regular divider thickness is 10, be sure to update that part of the code to
fit your project.)


/*  During live resize of the window, lock the left side, the collection
side, and resize the tableside
    The frames have to be set to add up to the total size minus the divider
thickness */
- (void)splitView:(NSSplitView *)sender
resizeSubviewsWithOldSize:(NSSize)oldSize {

    //detect if it's a window resize
    if ([self inLiveResize]) {

        //info needed
        NSRect tmpRect = [sender bounds];
        NSArray *subviews =  [sender subviews];
        NSView *collectionsSide = [subviews objectAtIndex:0];
        NSView *tableSide = [subviews objectAtIndex:1];
        float colllectionWidth = [collectionsSide bounds].size.width;

        //tableside frame: full size minus collection width and divider
        // My divider thickness is hard coded here as 1
        tmpRect.size.width = tmpRect.size.width - colllectionWidth + 1;
        tmpRect.origin.x = tmpRect.origin.x + colllectionWidth + 1;
        [tableSide setFrame:tmpRect];

        //collection frame stays the same
        tmpRect.size.width = colllectionWidth;
        tmpRect.origin.x = 0;
        [collectionsSide setFrame:tmpRect];

    }
    else
        [super adjustSubviews];
}

Regards,
Conor
http://www.bruji.com/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Stop NSSplitView from resizing with Window?
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: .rsrc how to
  • Next by Date: Re: .rsrc how to
  • Previous by thread: Re: Stop NSSplitView from resizing with Window?
  • Next by thread: Re: Stop NSSplitView from resizing with Window?
  • Index(es):
    • Date
    • Thread