自定义目录图标 Swift
Custom Directory Icon Swift
我有代码:
do {
try manager.createDirectory(atPath: appDir!.appendingPathComponent(path).path, withIntermediateDirectories: true, attributes: nil)
} catch {
print("Error: \(error)")
}
如何将自定义图标添加到目录(如 Dropbox、Creative Cloud 等)?我是否将其添加为属性?
知道了!
NSWorkspace.shared().setIcon(#imageLiteral(resourceName: "customFolder"), forFile: appDir!.appendingPathComponent("/Files").path, options: NSWorkspaceIconCreationOptions.excludeQuickDrawElementsIconCreationOption)
用那个。
我有代码:
do {
try manager.createDirectory(atPath: appDir!.appendingPathComponent(path).path, withIntermediateDirectories: true, attributes: nil)
} catch {
print("Error: \(error)")
}
如何将自定义图标添加到目录(如 Dropbox、Creative Cloud 等)?我是否将其添加为属性?
知道了!
NSWorkspace.shared().setIcon(#imageLiteral(resourceName: "customFolder"), forFile: appDir!.appendingPathComponent("/Files").path, options: NSWorkspaceIconCreationOptions.excludeQuickDrawElementsIconCreationOption)
用那个。