开发者

Observe published values of Quartz Composition without using QCView and QCPatchController

I've been looking for some ways to control Quartz Composition, that is being loaded as a sublayer of a custom view inherited from NSView.

NSString * compositionPath = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"qtz"];
QCCompositionLayer *myQCCompositionLayer = [[QCCompositionLayer compositionLayerWithFile:compositionPath] retain];
// Borderless window with custom view
[[self.contentView layer] addSublayer: myQCCompositionLayer];

Manually i found out, that the following code works for setting published input values:

[myQCCompositionLayer setValue:@"123" forInputKey:@"published_text_input"];

So i was trying to find t开发者_JAVA技巧he way to watch published output values and i was wondering if observer should do it. Written something like this:

[myQCCompositionLayer addObserver:self forKeyPath:@"published_output_value" options:0 context:nil];

And this in the same class:

- (void) observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object
                     change:(NSDictionary*)change context:(void*)context
{
    NSLog(@"123");
}

But it doesn't work. Maybe keypath is incorrect or this code shouldn't work at all :)

So are there any ways to observe published values of my composition?

Thanks for help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜