CALayers only showing up sometimes?

Discussion in 'Mac Programming' started by Chirone, Mar 25, 2009.

  1. Chirone macrumors 6502

    Mar 2, 2009
    hi all,
    the CALayers aren't displaying in my code like they do in the sample code

    the only way i can get a quicktime layer to show up on an NSView is if i copy and past the NSView from a working example and paste it into my code
    the strange thing is, is that i don't understand what's different between the NSView that will display the layer and the brand new one pulled out from IB
    the inspector shows no difference at all, and yet they are both different. what gives?

    also, there seems to be only one way to get a layer to even show up.
    compositionView.layer = mMovieLayer;
    where mMovieLayer is a QTMovieLayer* and compositionView is a IBOutlet NSView*

    [rootLayer addSublayer: exampleQTMovieLayer];
    	compositionView.layer = rootLayer;
    where rootLayer is a CALayer and exampleQTMovieLayer is a QTMovieLayer
    this code shows up with nothing...
    i even put in the code
    [compositionView setWantsLayer: YES];
    thinking it would help... but nothing...

    I thought if i could build up the sublayers and put drawings on the QT clip then it would work, and i could just export out a QT like i saw in someone elses example code.

    but as soon as i use sublayer nothing shows up...
    it works in everyone elses code... i can't see what i'm doing wrong...

    i do get a warning when i compile about the rootLayer though
    caused by these lines here:
    CALayer* rootLayer = [[CALayer alloc] init];
        compositionView.layer = rootLayer;

Share This Page