Моя цель - собрать файл Quartz Composer в Xcode и создать файл .saver. В настоящее время я использую предварительно подготовленный шаблон Xcode, но у меня проблемы с работой заставки. Я импортирую файл .qtz в проект и используя QCView
, чтобы отобразить его на экране, однако, когда я тестирую встроенный файл .saver, все, что я вижу, это черный экран.Заставка кварцевого композитора в Xcode
- (instancetype)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
self = [super initWithFrame:frame isPreview:isPreview];
if (self) {
[self setAnimationTimeInterval:1/30.0];
NSRect viewBounds = [self bounds];
//create the quartz composition view
qcView = [[QCView alloc] initWithFrame: NSMakeRect(0, 0, viewBounds.size.width, viewBounds.size.height)];
//make sure it resizes with the screensaver view
[qcView setAutoresizingMask:(NSViewWidthSizable|NSViewHeightSizable)];
//match its frame rate to your screensaver
[qcView setMaxRenderingFrameRate:30.0f];
//get the location of the quartz composition from the bundle
NSString* compositionPath = [[NSBundle mainBundle] pathForResource:@"QuartzComposerFileName" ofType:@"qtz"];
//load the composition
[qcView loadCompositionFromFile:compositionPath];
//add the quartz composition view
[self addSubview:qcView];
}
return self;
}