This is how I added a Quartz Composer Composition into an XCode 5 application programmatically so the QCC fills a window and resizes with it.
NSString *path = [[NSBundle mainBundle] pathForResource:@"NameOfQCComposition" ofType:@"qtz"];
NSView *superView = [self.displayWindow contentView];
qcView = [[QCView alloc] initWithFrame:superView.frame];
[superView addSubview:qcView];
[superView setTranslatesAutoresizingMaskIntoConstraints:YES];
[superView setAutoresizesSubviews:YES];
[qcView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[superView addConstraint:
[NSLayoutConstraint constraintWithItem: qcView
attribute: NSLayoutAttributeWidth
relatedBy: NSLayoutRelationEqual
toItem: superView
attribute: NSLayoutAttributeWidth
multiplier:1
constant:0]];
[superView addConstraint:
[NSLayoutConstraint constraintWithItem: qcView
attribute: NSLayoutAttributeHeight
relatedBy: NSLayoutRelationEqual
toItem: superView
attribute: NSLayoutAttributeHeight
multiplier:1
constant:0]];
[superView addConstraint:
[NSLayoutConstraint constraintWithItem: qcView
attribute: NSLayoutAttributeCenterX
relatedBy: NSLayoutRelationEqual
toItem: superView
attribute: NSLayoutAttributeCenterX
multiplier:1
constant:0]];
[superView addConstraint:
[NSLayoutConstraint constraintWithItem: qcView
attribute: NSLayoutAttributeCenterY
relatedBy: NSLayoutRelationEqual
toItem: superView
attribute: NSLayoutAttributeCenterY
multiplier:1
constant:0]];
[qcView unloadComposition];
[qcView loadCompositionFromFile:path];
[qcView setMaxRenderingFrameRate: 30.0];
[qcView startRendering];
if(![qcView loadCompositionFromFile:path])
{
NSLog(@"******QC.qtz failed to load");
[NSApp terminate:nil];
}
NSLog(@"******qc.qtz has been loaded!!!!");