Optimized image resources.
This commit is contained in:
@@ -13,6 +13,20 @@ import AppKitPlus
|
||||
/// only be initialized from a nib or storyboard.
|
||||
public class TrackTableCellView: AdvancedTableCellView {
|
||||
|
||||
// MARK: Types
|
||||
|
||||
private struct Images {
|
||||
|
||||
/// Caches the tick image for track cells so that it does not need to be
|
||||
/// reloaded every time a cell is configured.
|
||||
static let tickImage = NSImage(named: "Tick")?.imageByMaskingWithColor(NSColor.clearColor())
|
||||
|
||||
/// Caches the gray tick image for track cells so that it does not need to be
|
||||
/// reloaded every time a cell is configured.
|
||||
static let grayTickImage = NSImage(named: "Tick")?.imageByMaskingWithColor(NSColor.lightGrayColor())
|
||||
|
||||
}
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// An outlet do display the track number. This acts as a secondary label.
|
||||
@@ -97,9 +111,9 @@ public class TrackTableCellView: AdvancedTableCellView {
|
||||
secondaryTextField?.stringValue = track.artistName
|
||||
trackNumberTextField?.stringValue = "\(track.trackNumber)"
|
||||
if track.associatedTracks.isEmpty {
|
||||
imageView?.image = NSImage(named: "TickBW")
|
||||
imageView?.image = TrackTableCellView.Images.grayTickImage
|
||||
} else {
|
||||
imageView?.image = NSImage(named: "Tick")
|
||||
imageView?.image = TrackTableCellView.Images.tickImage
|
||||
}
|
||||
if track.saved {
|
||||
let aspectRatioConstraint = NSLayoutConstraint(
|
||||
|
||||
Reference in New Issue
Block a user