QTMovieViewの関数を書いています。QTMovieView をダブルクリックして、全画面表示モードを終了させたいと考えています。QTMovieView は AppController.m によって制御され、AppController に exit fullscreenmode 関数を記述します。QTMovieViewをダブルクリックするイベントをキャプチャしたいからです。したがって、mouseDown イベントをオーバーライドする必要があります。Override 関数は「QTMovieView+TFOverrideDrag.h」に記述されています。
QTMovieView+TFOverrideDrag.m
#import "QTMovieView+TFOverrideDrag.h"
#include "AppController.h"
@implementation QTMovieView (TFOverrideDrag)
- (void)mouseDown:(NSEvent *)theEvent
{
[self.superview becomeFirstResponder];
NSInteger clickCount = [theEvent clickCount];
if (2 == clickCount) {
[AppController exitFullScreen:self];
NSLog(@"SS");
}
NSLog(@"MDown");
}
この関数は正常にオーバーライドされます。しかし、exitFullScreen 関数は失敗します。どうすれば修正できますか?ありがとう
アップデート
AppController.h
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <QTKit/QTKit.h>
@interface AppController : NSDocument
{
QTMovie *qtmovie;
QTMovieView *_movieView;
}
@property (assign) IBOutlet QTMovieView *movieView;
- (IBAction)toggleFullscreen:(id)sender;
+(IBAction)exitFullScreen:(id)sender;
@end
AppController.m
#import "AppController.h"
@implementation AppController
@synthesize movieView=_movieView;
- (IBAction)toggleFullscreen:(id)sender
{
_movieView=_movieView;
NSDictionary *fullScreenOptions = [[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]forKey:NSFullScreenModeSetting] retain];
[_movieView enterFullScreenMode:[[NSScreen mainScreen] retain] withOptions:fullScreenOptions];
}
+(void)exitFullScreen:(id)sender
{
_movieView=_movieView;
NSLog(@"exitFullscreen");
NSDictionary *fullScreenOptions = [[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]forKey:NSFullScreenModeSetting] retain];
[_movieView exitFullScreenModeWithOptions:fullScreenOptions];
}
@end