0

AVFoundation と QuartzCore の開発は初めてで、CALayers に問題があります。これがばかげた問題である場合は申し訳ありません。

これが私のコードです:

.h

#import <Cocoa/Cocoa.h>
#import <AVFoundation/AVFoundation.h>
#import <QuartzCore/QuartzCore.h>
@interface Document : NSPersistentDocument 
{
    AVPlayer *player;
    AVPlayerLayer *playerLayer;
    NSView *playerView;
}
@property AVPlayerLayer *playerLayer;
@property AVPlayer *player;
@property IBOutlet NSView *playerView;


@end

.m

#import "Document.h"

@implementation Document
@synthesize playerView;
@synthesize player;
@synthesize playerLayer;

- (id)init
{
    self = [super init];
    if (self) {    
    }
    return self;
}

- (NSString *)windowNibName
{
    return @"Document";
}

- (void)windowControllerDidLoadNib:(NSWindowController *)aController
{
    [super windowControllerDidLoadNib:aController];
    [[aController window] setMovableByWindowBackground:YES];

    // HERE the layer is nill, and I don't understand why it's not getting initialized?! 
    [[[self playerView] layer] setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
}

+ (BOOL)autosavesInPlace
{
    return YES;
}
@end

どんな種類の助けも大歓迎です!

4

1 に答える 1