Improving moving view animation
Improving moving view animation
- Subject: Improving moving view animation
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 16 Mar 2010 19:38:14 +0100
Hello all.
I have 2 views (one is hidden, or out of the super view frame) and when I click on button that hidden view shows up and the other one resizes, if I clcik the button again, it happens the opposite one hides and the other resizes
So all it s working, and its ok, but somehow I see the animation a little bit too choppy sometimes, and I mean this animation its very simple don't know why it does it. so this is what I do
if(!isExpanded){
NSRect summaryFrame = [[_summaryViewController view] frame];
NSRect summaryFrameAux = summaryFrame;
summaryFrame.origin.y = -1 * summaryFrame.size.height;
[[_summaryViewController view] setFrame: summaryFrame];
[_myUserListView addSubview:[_summaryViewController view]];
NSRect newFrame = summaryFrameAux;
newFrame.size.width = [_myUserListView frame].size.width;
NSViewAnimation * anim = [[[NSViewAnimation alloc] initWithViewAnimations:[
NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[_summaryViewController view], NSViewAnimationTargetKey,[NSValue valueWithRect:summaryFrame],NSViewAnimationStartFrameKey, [NSValue valueWithRect:newFrame],NSViewAnimationEndFrameKey,nil],nil]] autorelease];
[anim setDelegate:self];
[anim setFrameRate:50];
[anim setDuration:0.40];
[anim setAnimationCurve:NSAnimationEaseInOut];
[anim setAnimationBlockingMode:NSAnimationNonblockingThreaded];
[anim startAnimation];
[[_expansionButton cell] setTitle:@"▼"];
}
else {
NSRect frameInit = [userListView frame];
NSRect frame = frameInit;
NSRect summaryFrame = [[_summaryViewController view] frame];
NSRect summaryFrameAux = summaryFrame;
summaryFrame.origin.y = -1 * summaryFrame.size.height;
//[[_summaryViewController view] setFrame: summaryFrame];
frame.size.height += 250.0f;
frame.origin.y = 0.0;
[userListView setFrame:frame];
NSViewAnimation * anim = [[[NSViewAnimation alloc] initWithViewAnimations:
[NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:[_summaryViewController view],
NSViewAnimationTargetKey,[NSValue valueWithRect:summaryFrameAux],NSViewAnimationStartFrameKey,
[NSValue valueWithRect:summaryFrame],NSViewAnimationEndFrameKey,nil],nil]] autorelease];
[anim setDelegate:self];
[anim setFrameRate:50];
[anim setDuration:0.4];
[anim setAnimationCurve:NSAnimationEaseInOut];
[anim setAnimationBlockingMode:NSAnimationNonblockingThreaded];
[anim startAnimation];
[[_expansionButton cell] setTitle:@"▲"];
}
Any ideas what to do?
Thanks
Gustavo
_______________________________________________
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