OS X Lion:全屏 NSWindow 诱饵和转变
我目前有一个允许全屏的 NSWindow。该窗口下面有一个视频播放器和一个播放列表。当用户全屏显示时,我想删除播放列表并仅显示视频。
我这样做的第一个想法是当我检测到全屏入口点时交换窗口。我发现我可以通过以下方式检测到这一点:
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
NSLog(@"My window is going fullscreen");
}
但此时我无法弄清楚如何将窗口换成新窗口。我尚未尝试的一种选择是修改视频的所有调整大小标志并隐藏其他组件,但我不确定这是否是最佳解决方案。
有人对更好的方法有什么建议吗?
I currently have a NSWindow that allows for full screen. The window has a video player and a playlist below it. When the user goes fullscreen, I want to get rid of the playlist and just show the video.
My first thoughts for doing this is to swap out the window when I detect a fullscreen entry point. I have found that I can detect this with the following:
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
NSLog(@"My window is going fullscreen");
}
But I have been unable to figure out how to swap out the window for a new one at this point. One option I haven't yet attempted would be to modify all of the resizing flags of the video and hide the other components but I'm not certain if this would be the best solution.
Does anyone have any suggestions on a better way for doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么要换窗户?只需操纵窗口中的视图即可。
只需在使用
-removeFromSuperview
全屏显示时从视图中删除播放列表,然后调整视频视图大小,使其充满您的窗口即可。确保您在某处将视图引用作为 ivar,否则视图将被释放。然后,您可以使用该引用在窗口退出全屏模式时重新添加视图。
Why do you want to swap the window? Just manipulate the views in the window.
Just remove the playlist from your view when you go fullscreen with
-removeFromSuperview
and then resize the video view so that it fills your window.Make sure you hold a reference to the view as an ivar somewhere, because otherwise the view will be deallocated. You can then use that reference to add the view back when the window exits full-screen mode.