Cocoa NSImage full view question
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];
}
He开发者_如何学JAVAre is the Image:
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.
精彩评论