• 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: Animated split view collapsing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Animated split view collapsing


  • Subject: Re: Animated split view collapsing
  • From: Paul Kim <email@hidden>
  • Date: Mon, 1 May 2006 18:42:45 -0400

Hi Larry,

I think the problem is that you need to resize both views in the animation. Have one view collapse while the other expands. In addition, since the animation will set the view to "hidden" when it collapses it, you need to unhide it when expanding it back out (I think this is what causes your view to disappear).

The code below is more specific to my case where only one of the two views is uncollapsed at any one time but it demonstrates how to do the animation. In conjunction with the display call in the delegate method, it works for me. I left out the horizontal case for brevity. Also, I don't hide the splitter (I think you asked for that originally?) but you should be able to adapt it from here.

paul

===================================================================

    NSView		 *targetView1, *targetView2;
    NSRect		 endFrame1, endFrame2, bounds;
    NSDictionary *animationParameters1, *animationParameters2;
    NSViewAnimation *animation;

bounds = [self bounds];

targetView1 = [[self subviews] objectAtIndex:0];
targetView2 = [[self subviews] objectAtIndex:1];

endFrame1 = [targetView1 frame];

if ([targetView1 isHidden])
{
endFrame1.size.height = bounds.size.height - [self dividerThickness];
[targetView1 setHidden:NO];
}
else
{
endFrame1.size.height = 0.0;
}

endFrame2 = [targetView2 frame];

if ([targetView2 isHidden])
{
endFrame2.size.height = bounds.size.height - [self dividerThickness];
[targetView2 setHidden:NO];
}
else
{
endFrame2.size.height = 0.0;
}

animationParameters1 = [NSDictionary dictionaryWithObjectsAndKeys: targetView1, NSViewAnimationTargetKey,
[NSValue valueWithRect: endFrame1], NSViewAnimationEndFrameKey, nil];
animationParameters2 = [NSDictionary dictionaryWithObjectsAndKeys: targetView2, NSViewAnimationTargetKey,
[NSValue valueWithRect: endFrame2], NSViewAnimationEndFrameKey, nil];

animation = [[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObjects:animationParameters1, animationParameters2]];

[animation setAnimationBlockingMode:NSAnimationBlocking];
[animation setDuration:0.25];

[animation startAnimation];
[animation release];
[self adjustSubviews];




On May 1, 2006, at 11:54 AM, Lawrence Sanbourne wrote:

Hi Paul,

I think we're getting closer! Two things:

1. I found and fixed a bug where I was accidentally not setting the
origin of the subview end frame properly.

2. I put the -display call in that method, but I ran into some
problems with knowing which of my split views was being resized. So, I
put it in -splitView:resizeSubviewsWithOldSize:, and got something
new: The view now shrinks and enlarges properly, but after its first
shrinking, it no longer displays the content -- it just displays the
window background. Has this ever happened to you?

Also, the app now hangs when I resize certain other views. It stops
when I change -display to -setNeedsDisplay: (which then doesn't fix
the real problem), but I think I can debug this myself.

Larry

On 4/29/06, Paul Kim <email@hidden> wrote:

Try doing a display on the splitview in the following delegate method:


- (void)splitViewDidResizeSubviews:(NSNotification *)aNotification

Seems to fix the display problems for me at least.

paul

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


This email sent to email@hidden


_______________________________________________ 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: Animated split view collapsing
      • From: "Lawrence Sanbourne" <email@hidden>
References: 
 >Re: Animated split view collapsing (From: "Lawrence Sanbourne" <email@hidden>)

  • Prev by Date: KVO: NSObjectController won't contain File's Owner attribute
  • Next by Date: Re: filling a TableView with pre-existing data
  • Previous by thread: Re: Animated split view collapsing
  • Next by thread: Re: Animated split view collapsing
  • Index(es):
    • Date
    • Thread