开发者

resizing QTMovieView is not working

I want to load a movie in local, here is code:

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];

The movie.m4v开发者_运维技巧 has width:1024 and height:768 and I want to keep window in size (1024, 768). I want to resize movieView 861x646 size. But when displaying on window, it still is 1024x768 size.

How can I resize the movie to 861x646 size?


You're setting the movie view as the window's content view, so it'll automatically become the content size of the window and stay that way. What you seem to want to do is add your view to the window's content view.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜