如何退出全屏模式,如何退出全屏模式后,接收键盘事件的的NSView
答案:1 悬赏:50 手机版
解决时间 2021-04-03 19:55
- 提问者网友:沉默菋噵
- 2021-04-03 07:24
如何退出全屏模式,如何退出全屏模式后,接收键盘事件的的NSView
最佳答案
- 五星知识达人网友:想偏头吻你
- 2021-04-03 07:54
ì子类的的NSView并启动全屏模式,当应用程序完成启动。该视图可作为财产fooView在应用程序委托。// AppDelegate.m
- (void)applicationDidFinishLaunching:(NSNotification*)notification {
[[self window] makeKeyAndOrderFront:self];
[[self fooView] enterFullScreenMode:[NSScreen mainScreen] withOptions:nil];
}
类FooView本身以下函数。// FooView.m
- (void)keyDown:(NSEvent*)event {
NSLog(@%@ %@ - %@, self.className, NSStringFromSelector(_cmd), event);
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
- (void)cancelOperation:(id)sender {
NSLog(@%@ %@ - %@, self.className, NSStringFromSelector(_cmd), sender);
[self exitFullScreenModeWithOptions:nil];
}
- (void)applicationDidFinishLaunching:(NSNotification*)notification {
[[self window] makeKeyAndOrderFront:self];
[[self fooView] enterFullScreenMode:[NSScreen mainScreen] withOptions:nil];
}
类FooView本身以下函数。// FooView.m
- (void)keyDown:(NSEvent*)event {
NSLog(@%@ %@ - %@, self.className, NSStringFromSelector(_cmd), event);
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
- (void)cancelOperation:(id)sender {
NSLog(@%@ %@ - %@, self.className, NSStringFromSelector(_cmd), sender);
[self exitFullScreenModeWithOptions:nil];
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯