如何使用swift实现此代码?隐藏码头图标集

时间:2014-07-25 13:26:26

标签: swift

添加徽章

[[NSApp dockTile] setBadgeLabel:[NSString stringWithFormat:@"%d", random() % 11]];
[NSApp setActivationPolicy: NSApplicationActivationPolicyProhibited];

如何使用此代码快速实现?

1 个答案:

答案 0 :(得分:1)

尝试

let doc =  NSApp.dockTile as NSDockTile
doc.badgeLabel = NSString(format: "%d", random() % 11)
NSApp.setActivationPolicy(.Prohibited)