NSView から継承されたカスタム ビューのサブレイヤーとして読み込まれている Quartz コンポジションを制御する方法を探していました。
NSString * compositionPath = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"qtz"];
QCCompositionLayer *myQCCompositionLayer = [[QCCompositionLayer compositionLayerWithFile:compositionPath] retain];
// Borderless window with custom view
[[self.contentView layer] addSublayer: myQCCompositionLayer];
手動で、公開された入力値を設定するために次のコードが機能することがわかりました。
[myQCCompositionLayer setValue:@"123" forInputKey:@"published_text_input"];
だから私は公開された出力値を見る方法を見つけようとしていたのですが、オブザーバーがそれをやるべきかどうか疑問に思っていました. 次のように書かれています。
[myQCCompositionLayer addObserver:self forKeyPath:@"published_output_value" options:0 context:nil];
そして、これは同じクラスで:
- (void) observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object
change:(NSDictionary*)change context:(void*)context
{
NSLog(@"123");
}
しかし、うまくいきません。キーパスが間違っているか、このコードがまったく機能しない可能性があります:)
私の構成の公開された値を観察する方法はありますか?
手伝ってくれてありがとう。