CALayer scaling issue
CALayer scaling issue
- Subject: CALayer scaling issue
- From: Kishore Gedela <email@hidden>
- Date: Fri, 23 Jan 2009 12:07:26 +0530
Hi,
I'm working on a slide show application, in that I have a Custom View
which has a layer. On top of that layer I've several sub-layers. The
custom view is enclosed in a scroll view.
When the user switches to fullscreen, I'm calling
enterFullScreenMode:withOptions: method on the custom view.
When I switch back to the window mode (using
exitFullScreenMode:withOptions:), I'm facing several problems with the
scrollers. If I drag the scrollers, they are scrolling back to the
initial position, when I release the mouse.
Scaling is also not working properly. The layer is going to the
center of the view.
Am I doing anything wrong here?
Here is the code. Thanks for any info/directions in resolving these
issues.
- (IBAction)runSlideShow:(id)sender
{
if ([displayBaseView isInFullScreenMode]) {
[displayBaseView exitFullScreenModeWithOptions:nil];
//Scale view back to the scalevalue.
[self scaleViewToValue:scaleValue];
[NSCursor unhide];
} else {
[NSCursor hide];
[self scaleViewToValue:1.0f];
[displayBaseView enterFullScreenMode:[NSScreen mainScreen]
withOptions:nil];
}
}
- (void)scaleViewToValue:(float)theValue
{
scaleValue = theValue;
[displayBaseView.layer setTransform:CATransform3DIdentity];
[displayBaseView.layer setTransform:CATransform3DMakeScale(theValue,
theValue, 1.0f)];
NSView *clipView = [[displayBaseView enclosingScrollView] contentView];
NSSize newBoundsSize = NSMakeSize(NSWidth([clipView frame])/theValue,
NSHeight([clipView frame])/theValue);
[clipView setBoundsSize: newBoundsSize];
}
Thanks
Kishore
_______________________________________________
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