CALayer scaling issue

  • 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
previous month january 2009 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Go to today