可可 NSImage 全视图问题
我试图在应用程序启动后自动全屏加载图像,但它看起来有点奇怪。可以看到图像视图的外边缘 - 如何消除它?我的代码如下所示:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSImage *imageFromBundle = [NSImage imageNamed:@"Screen.png"];
[image setImage:imageFromBundle];
[image enterFullScreenMode:[window screen] withOptions:nil];
}
这是图像:
I am trying to automatically load an image full screen after the application is launched but it looks just a little bit funky. The outside edge of the image view can be seen - how do I eliminate that? My code looks like this:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSImage *imageFromBundle = [NSImage imageNamed:@"Screen.png"];
[image setImage:imageFromBundle];
[image enterFullScreenMode:[window screen] withOptions:nil];
}
Here is the Image:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在全屏显示图像视图之前,将其边框设置为无。如果需要,可以在从全屏返回时将其更改回来,或者使用单独的图像视图进行全屏。
另外,您应该以更具描述性的方式命名变量。名为“image”的变量应包含指向图像的指针,而不是指向图像视图的指针。考虑将其命名为
imageView
。Set your image view's border to none before you take it full screen. If you want, change it back when coming back from full screen, or use a separate image view for full-screen.
Also, you should name your variables more descriptively. A variable named “image” should contain a pointer to an image, not to an image view. Consider it naming
imageView
instead.