可可 NSImage 全视图问题

发布于 2024-09-28 21:39:55 字数 409 浏览 0 评论 0原文

我试图在应用程序启动后自动全屏加载图像,但它看起来有点奇怪。可以看到图像视图的外边缘 - 如何消除它?我的代码如下所示:

- (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:
alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我最亲爱的 2024-10-05 21:39:55

在全屏显示图像视图之前,将其边框设置为无。如果需要,可以在从全屏返回时将其更改回来,或者使用单独的图像视图进行全屏。

另外,您应该以更具描述性的方式命名变量。名为“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文