• 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: Vertical NSplitViews buggy in Lion?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vertical NSplitViews buggy in Lion?


  • Subject: Re: Vertical NSplitViews buggy in Lion?
  • From: Raleigh Ledet <email@hidden>
  • Date: Mon, 26 Sep 2011 09:56:51 -0700

Have you filed a radar? You already have a test project, so the hard part is done. Please be sure to attach the test project to the radar.
-raleigh

On Sep 23, 2011, at 4:03 AM, Martin Hedenfalk wrote:

> Hi,
>
> I'm having problems with vertical NSSplitViews in Lion. I'm dynamically adding subviews and nesting horizontal and vertical NSSplitViews. I don't get these problems in Snow Leopard.
>
> Splitting horizontally seems to work fine, but splitting vertically causes several problems:
>
> - divider width is (sometimes) way too large
> - sometimes the divider is not shown at all
> - splitting time increases with number of subviews (10s with ~20 subviews)
> - the subview frames gets messed up and the following is printed in the console (here the two subviews overlap):
>
> 2011-09-23 11:54:28.745 splits[52596:707] <NSSplitView: 0x1003c8c80>: -resizeSubviewsWithOldSize: was invoked and left the subview frames in an inconsistent state:
> 2011-09-23 11:54:28.746 splits[52596:707] Split view bounds: {{0, 0}, {208, 215}}
> 2011-09-23 11:54:28.746 splits[52596:707]     Subview frame: {{0, 0}, {94, 215}}
> 2011-09-23 11:54:28.747 splits[52596:707]     Subview frame: {{89, 0}, {119, 215}}
> 2011-09-23 11:54:28.747 splits[52596:707] The subview frames are not in the same order as the subviews array. NSSplitView requires that these orders be kept consistent, otherwise behavior is undefined.
>
> I've made a minimal test project that shows the issue.
> It's available at http://bzero.se/splits.zip.
>
> This code does not use a delegate for the split view, so it can't be that I'm doing something weird in [splitView:resizeSubviewsWithOldSize:].
>
> The core of the code is the method that splits the content views (which contain a single NSTextView):
>
> - (NSViewController *)splitView:(NSViewController *)viewController
>                       withView:(NSViewController *)newViewController
>                     vertically:(BOOL)isVertical
> {
>    NSView *view = [viewController view];
>    NSView *newView = [newViewController view];
>    NSSplitView *split = (NSSplitView *)[view superview];
>
>    /* If there is only one subview in the split, convert it to the desired orientation. */
>    if ([[split subviews] count] == 1 && [split isVertical] != isVertical)
>        [split setVertical:isVertical];
>
>    if ([split isVertical] == isVertical) {
>        /* Same orientation, just add another view to this split. */
>        [split addSubview:newView];
>    } else {
>        /*
>         * Different orientation, replace the view with a new split view
>         * containing the new and old content views.
>         */
>        NSSplitView *newSplit = [[NSSplitView alloc] initWithFrame:[view frame]];
>        [newSplit setVertical:isVertical];
>        [newSplit setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
>        [newSplit setAutoresizesSubviews:YES];
>        [split replaceSubview:view with:newSplit];
>        [newSplit addSubview:view];
>        [newSplit addSubview:newView];
>        [newSplit release];
>    }
>
>    [window makeFirstResponder:newView];
>    [views addObject:newViewController];
>
>    return newViewController;
> }
>
> Am I doing something wrong with the subviews?
>
> TIA
> 	.martin
>
> _______________________________________________
>
> 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: Vertical NSplitViews buggy in Lion?
      • From: Martin Hedenfalk <email@hidden>
References: 
 >Vertical NSplitViews buggy in Lion? (From: Martin Hedenfalk <email@hidden>)

  • Prev by Date: How to create an expression?
  • Next by Date: Re: How to create an expression?
  • Previous by thread: Vertical NSplitViews buggy in Lion?
  • Next by thread: Re: Vertical NSplitViews buggy in Lion?
  • Index(es):
    • Date
    • Thread