2017-08-28 5 views
0

J'ai le code:Répertoire des icônes personnalisées Swift

do { 
    try manager.createDirectory(atPath: appDir!.appendingPathComponent(path).path, withIntermediateDirectories: true, attributes: nil) 
} catch { 
    print("Error: \(error)") 
} 

Comment puis-je ajouter une icône personnalisée dans le répertoire (comme Dropbox, Creative Cloud, etc.)? Est-ce que je l'ajoute en tant qu'attribut?

+0

Recherchez-le par vous-même. https://stackoverflow.com/search?q=%5Bosx%5D+folder+icon –

Répondre

0

L'a obtenu!

NSWorkspace.shared().setIcon(#imageLiteral(resourceName: "customFolder"), forFile: appDir!.appendingPathComponent("/Files").path, options: NSWorkspaceIconCreationOptions.excludeQuickDrawElementsIconCreationOption) 

Utilisez cela.

+0

Change-t-il l'icône de l'application ou l'icône du répertoire? –

+0

@LeoDabus icône de répertoire pour un certain chemin. – ctkrocks

+0

Votre code n'affiche aucun pah –