QTMovieView의 함수를 작성하고 있습니다. 전체 화면 모드를 종료하려면 QTMovieView를 두 번 클릭하고 싶습니다. QTMovieView는 AppController.m에 의한 제어이며 AppController에서 exit fullscreenmode 함수를 작성합니다. QTMovieView를 두 번 클릭하면 이벤트를 캡처하기 때문에. 그래서 mouseDown 이벤트를 오버라이드해야합니다. 재정의 기능은다른 클래스의 변수를 조작하는 방법
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");
}
은 "QTMovieView + TFOverrideDrag.h"에서 작성하고 성공적으로이 기능을 재정의한다. 그러나 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
카테고리를 통해 구현을 제공하지 않고 *'QTMovieView '를 * 서브 클래스해야합니다. – trojanfoe
하지만 exitFullscreen을 어떻게 수행합니까? –
.h와 .m 파일 모두에서'exitFullScreen' 코드를 게시 할 수 있습니까? – FreeAsInBeer