我是Xcode的新手,试图为Quartz Composition创建一个独立的应用程序。
Xcode 5.1.1 Quartz Composer 4.6(151)
步骤取自this video
我创建了一个新的Cocoa应用程序。
在“界面”构建器中打开MainMenu.xib。
拖放" Quartz Composer View"进入新窗口。
加载成分,我选择一个空白成分(注意:这是用我的最终成分和空白成分测试的)
返回主项目屏幕 - > Linked Frameworks and Libraries
- > Add Framework
- > Quartz.framework
和QuartzCore.framework
。
构建,这就是我得到的。
The document "MainMenu.xib" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)
奇怪的是我的 Quartz output shows up fine in my Interface Builder window,但我的应用无法构建或运行。
答案 0 :(得分:0)
答案 1 :(得分:0)
这就是我以编程方式将Quartz Composer组合添加到XCode 5应用程序中的方式,以便QCC填充窗口并随之调整大小。
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!!!!");