1

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
4

2 に答える 2

0

AppControllerのようなクラスメソッドを宣言しています+(void)exitFullScreen:か? そうでない場合は、インスタンス メソッドをクラス メソッドに変更する ( の+代わりに を使用する-) か、クラスをサブクラス化しQTMovieView、 のインスタンスをインスタンスに渡す必要がAppControllerあります。

于 2013-01-02T19:04:34.720 に答える
0

問題が解決しました!!!私はこれで問題を修正しました:

- (void)mouseDown:(NSEvent *)theEvent
{
   [self.superview becomeFirstResponder];
    NSInteger clickCount = [theEvent clickCount];
    if (2 == clickCount) {
        NSDictionary *fullScreenOptions = [[NSDictionary dictionaryWithObject:[NSNumber     numberWithBool:YES]forKey:NSFullScreenModeSetting] retain];
        [super enterFullScreenMode:[[NSScreen mainScreen] retain] withOptions:fullScreenOptions];
        NSLog(@"SS");
    }
    NSLog(@"MDown");
}    

キーは「スーパー」です。

于 2013-01-09T02:36:33.073 に答える