【问题标题】:resizing QTMovieView is not working调整 QTMovieView 的大小不起作用
【发布时间】:2011-07-05 10:36:10
【问题描述】:

我想在本地加载一部电影,代码如下:

movie = [[QTMovie alloc]initWithFile:[[NSBundle mainBundle]pathForResource:@"movie" ofType:@"m4v"] error:nil];

movieView = [[QTMovieView alloc]initWithFrame:NSMakeRect(0, 0, 861, 646)];
[movieView setDelegate:self];

[movieView setMovie:movie];

[movie play];
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlaybackDidFinished:) 
                                             name:QTMovieDidEndNotification 
                                           object:movie];

[movieView setControllerVisible:NO];

[movieView setAutoresizesSubviews:YES];
[movieView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[self.window setContentView:movieView];

movie.m4v 的宽度:1024 和高度:768,我想保持窗口大小(1024、768)。我想调整movieView 861x646 的大小。但是在窗口上显示时,它仍然是 1024x768 大小。

如何将影片大小调整为 861x646 尺寸?

【问题讨论】:

    标签: cocoa macos


    【解决方案1】:

    您将电影视图设置为窗口的内容视图,因此它将自动成为窗口的内容大小并保持不变。您似乎想要做的是将您的视图添加到窗口的内容视图中。

    [[[self window] contentView] addSubview:movieView];
    

    【讨论】:

      猜你喜欢
      • 2015-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多