0
我正在开发一个使用全屏窗口的简单应用程序。可可应用程序进入全屏幕
窗口包含视图包含按钮,图像等等...,但是当我在全屏幕与后续的行中输入:
NSWindow* tmp = [self window];
[tmp setStyleMask:NSBorderlessWindowMask];
[tmp setFrame:[tmp frameRectForContentRect:[[tmp screen] frame]]display:YES animate:NO];
[tmp setBackingType:NSBackingStoreBuffered];
screenRect = [[NSScreen mainScreen] frame];
int windowLevel = CGShieldingWindowLevel();
[self.window setLevel:windowLevel];
我把窗口视图不自动调整大小,我可以做一些正确调整大小的操作,但有一种方法可以自动执行该操作?
我后我所有的AppController这里:
-(id)init {
self = [super initWithWindowNibName:@"MainWindow"];
NSWindow* tmp = [self window];
[tmp setStyleMask:NSBorderlessWindowMask];
[tmp setFrame:[tmp frameRectForContentRect:[[tmp screen] frame]]display:YES animate:NO];
[tmp setBackingType:NSBackingStoreBuffered];
screenRect = [[NSScreen mainScreen] frame];
/**
// [[tmp standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
// [[tmp standardWindowButton:NSWindowZoomButton] setHidden:YES];
self.window = [[NSWindow alloc] initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO screen:[NSScreen mainScreen]];
**/
int windowLevel = CGShieldingWindowLevel();
[self.window setLevel:windowLevel];
return self;
}
// We need to be layer-backed to have subview transitions.
-(void)awakeFromNib {
[[self window] setContentSize:[topMenu frame].size];
[[[self window] contentView] addSubview:topMenu];
[topMenu enterFullScreenMode:[NSScreen mainScreen] withOptions:nil];
[[[self window] contentView] setWantsLayer:YES];
}
- (void)dealloc
{
[super dealloc];
}
- (void)windowDidLoad
{
[super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
[topMenu_controller performAnimation];
return;
}
的联系是过时的,我必须搜索布局? – pedr0 2011-03-10 08:44:50
您需要为视图设置尺寸属性,以便它保持与窗口相同的比例。在界面生成器中选择视图,然后选择工具→显示检查器,然后从检查器窗口顶部的下拉列表中选择大小。检查器窗口的下半部分包含标有“自动调整”的部分。这些被称为“弹簧和支柱”。 单击内部框中的水平线和垂直线,以便它们变成弹簧。这会导致文本视图的内部大小随着窗口的增长而缩小。 – 2011-03-10 17:44:18
[Here's](https://web.archive.org/web/20100901161944/http://developer.apple.com:80/mac/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html)an该文档的归档版本和[这里是](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/index.html#//apple_ref/doc/uid/TP40010853-CH7-SW1 )一些文件解释苹果新的布局引擎,自动布局。 – NobodyNada 2017-05-11 23:43:36