Domanda

I want to set a background color to a view and as of now I have subclassed that view in Xib and in drawRect method I am setting the color.

- (void)drawRect:(NSRect)dirtyRect {
    [[NSColor blackColor] setFill];
    NSRectFill(dirtyRect);
    [super drawRect:dirtyRect];
}

Am using [self.view enterFullScreenMode:screen withOptions:nil]; to show the view(which contains an image) in fullscreen. But when view is in fullscreen it shows a default gray background instead of black color. How can I set the background to black ?

È stato utile?

Soluzione

Are you sure your methods calling? Put a NSLog to make sure.

If it is, then delete the line [super drawRect:dirtyRect];

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top