私の NSProgressIndicator は、別のビューに切り替えるとビューでアニメーション化され、元の NSProgressIndicator が消えます。
なぜ?
別のビューに切り替えるための私のコードは次のとおりです
- (void)switchToView:(NSView *)newView withAnimate:(BOOL)animate
{
if ([[rootView subviews] count] != 0)
{
[rootView setWantsLayer:YES];
[rootView displayIfNeeded];
NSTimeInterval duration = [[self window] animationResizeTime:newFrame];
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.25];
[[rootView animator] replaceSubview:[[rootView subviews] objectAtIndex:0] with:newView];
[NSAnimationContext beginGrouping];
if (duration > 0.25) {
[[NSAnimationContext currentContext] setDuration:0.25];
}
else{
[[NSAnimationContext currentContext] setDuration:duration];
}
[[[self window] animator] setFrame:newFrame display:YES animate:YES];
[NSAnimationContext endGrouping];
[NSAnimationContext endGrouping];
[self performSelector:@selector(endAnimation) withObject:nil afterDelay:0.25f];
}
}
-(void)endAnimation{
[[ _mainWindow contentView] setWantsLayer:NO];
}
ビューを置き換えて、フェードアウトアニメーション NSProgressIndicator を作成し、ビューで常にアニメーション化します。