mirror of
https://github.com/zhigang1992/PINRemoteImage.git
synced 2026-06-15 10:18:09 +08:00
61 lines
1002 B
Objective-C
61 lines
1002 B
Objective-C
//
|
|
// PINViewWithBackgroundColor.m
|
|
// PINRemoteImage
|
|
//
|
|
// Created by Michael Schneider on 1/5/16.
|
|
// Copyright © 2016 mischneider. All rights reserved.
|
|
//
|
|
|
|
#import "PINViewWithBackgroundColor.h"
|
|
|
|
@implementation PINViewWithBackgroundColor
|
|
|
|
|
|
#pragma mark - Lifecycle
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self == nil) { return self; }
|
|
[self initPINViewWithBackgroundColor];
|
|
return self;
|
|
}
|
|
|
|
|
|
- (instancetype)initWithCoder:(NSCoder *)coder
|
|
{
|
|
self = [super initWithCoder:coder];
|
|
if (self == nil) { return self; }
|
|
[self initPINViewWithBackgroundColor];
|
|
return self;
|
|
}
|
|
|
|
- (void)initPINViewWithBackgroundColor
|
|
{
|
|
self.wantsLayer = YES;
|
|
}
|
|
|
|
|
|
#pragma mark - NSView
|
|
|
|
- (BOOL)wantsUpdateLayer
|
|
{
|
|
return YES;
|
|
}
|
|
|
|
- (void)updateLayer
|
|
{
|
|
self.layer.backgroundColor = self.backgroundColor.CGColor;
|
|
}
|
|
|
|
|
|
#pragma mark - Setter
|
|
|
|
- (void)setBackgroundColor:(NSColor *)backgroundColor
|
|
{
|
|
_backgroundColor = backgroundColor;
|
|
[self setNeedsDisplay:YES];
|
|
}
|
|
|
|
@end
|