添加徽章
[[NSApp dockTile] setBadgeLabel:[NSString stringWithFormat:@"%d", random() % 11]];
[NSApp setActivationPolicy: NSApplicationActivationPolicyProhibited];
如何使用此代码快速实现?
答案 0 :(得分:1)
尝试
let doc = NSApp.dockTile as NSDockTile
doc.badgeLabel = NSString(format: "%d", random() % 11)
NSApp.setActivationPolicy(.Prohibited)