我正在编写 QTMovieView 的功能。我想双击 QTMovieView 使其退出全屏模式。QTMovieView 由 AppController.m 控制,我在 AppController 中编写了退出全屏模式功能。因为我想捕获双击 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 功能失败。我该如何解决?谢谢
更新
应用控制器.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
应用控制器.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