4

is there a way of acessing a structure from a Cocoa app? I am able to set integers and Strings using the QCView setvalue:forkey method but when i try to access a structure i run into errors. Basicly what i want to do is to pass a byte array into a Quartz composition.

greetings

matthias

Thomas Zoechling
  • 34,177
  • 3
  • 81
  • 112
madsonic
  • 763
  • 1
  • 6
  • 9

2 Answers2

2

To provide a structure to a composition, feed an NSDictionary or an NSArray to -setValue:forKey:.

For example, if you're starting with the Xcode "Quartz Composer Application" template, you could add the following code into AppController's -changeColorToBlue: method:

[qcView setValue:[NSDictionary dictionaryWithObjectsAndKeys:@"value1",@"key1",@"value2",@"key2",nil] forInputKey:@"Structure"];

or

[qcView setValue:[NSArray arrayWithObjects:@"a",@"b",nil] forInputKey:@"Structure"];
smokris
  • 11,740
  • 2
  • 39
  • 59
0

You can do this using Swift 3.1:

// for array
qcView.setValue(["Obj1", "Obj2"], forInputKey: "Structure")

// for dictionary
qcView.setValue(["key1":"val1", "key2":"val2"], forInputKey: "Structure")
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220