Re: CALayers Lost After Switching Window's ContentView
Re: CALayers Lost After Switching Window's ContentView
- Subject: Re: CALayers Lost After Switching Window's ContentView
- From: Scott Anguish <email@hidden>
- Date: Sun, 15 Feb 2009 18:25:31 -0500
It's hard to tell from this...
are you attempting to manually fiddle with (add layers, etc..) the
layer of a layer-backed view?
You shouldn't do that. It isn't yours. Only interact with the layers
if you're using views for layer-hosting
On 14-Feb-09, at 6:19 PM, Bridger Maxwell wrote:
Hey,
I have an application which must switch in and out of full screen
mode.
Going full screen is fine, but when I exit full-screen, my Core
Animation
components disappear! Some debugging shows that the CALayer that
backs the
view is still there and hasn't changed, but all of its sublayers
have been
removed. I have no idea why this would happen though. To go full
screen, I
make a new window and make it large and then switch the contentview
from the
old window to the full screen window and vice-versa for returning to
normal
mode. I don't see any reason why starting in normal mode and going
full
screen works fine, but the other way around messes with my Core
Animation
layers. Here is my go full screen code:
(regularWindow is an IBOutlet hooked up to a window in the
application's nib
file. fullScreenWindow is just an NSWindow instance variable)
- (void)enterFullScreen {
if (!isFullScreen) {
// Capture the main display
if (CGDisplayCapture( kCGDirectMainDisplay ) != kCGErrorSuccess) {
NSLog( @"Couldn't capture the main display" );
}
// Put up a new window
if (!fullScreenWindow) {
fullScreenWindow = [[SCWindow alloc] initWithContentRect:[[NSScreen
mainScreen] frame]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO screen:[NSScreen mainScreen]];
}
[fullScreenWindow setLevel:CGShieldingWindowLevel()];
[fullScreenWindow setContentView:fullScreenView];
[fullScreenWindow makeKeyAndOrderFront:nil];
[regularWindow orderOut:self];
isFullScreen = YES;
}
}
- (void)exitFullScreen {
if (isFullScreen) {
// Release the display(s)
if (CGDisplayRelease( kCGDirectMainDisplay ) != kCGErrorSuccess) {
NSLog( @"Couldn't release the display(s)!" );
}
[regularWindow setContentView:fullScreenView];
[regularWindow makeKeyAndOrderFront:nil];
[fullScreenWindow orderOut:self];
isFullScreen = NO;
}
}
Thank You,
Bridger Maxwell
_______________________________________________
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