开发者

cocoa objective-c: Change background color of custom view

开发者 https://www.devze.com 2023-02-05 10:15 出处:网络
If I have a bunch of custom views that I 开发者_开发知识库made in IB, how can I set up a background color for each when the app awakesFromNib? In your NSView subclass:

If I have a bunch of custom views that I 开发者_开发知识库made in IB, how can I set up a background color for each when the app awakesFromNib?


In your NSView subclass:

- (void)drawRect:(NSRect)aRect
{
    [[NSColor redColor] set];
    NSRectFill([self bounds]);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消