How to show the share button in Mountain Lion?

后端 未结 3 1882
长发绾君心
长发绾君心 2021-02-03 12:06

Mountain Lion offers a built-in sharing button that reveals a menu of sharing services appropriate for the app:

\"Sh

3条回答
  •  暖寄归人
    2021-02-03 12:13

    In Swift, I've used this:

    extension NSSharingService {
        class func shareContent ( content: [AnyObject], button: NSButton ) {
            let sharingServicePicker = NSSharingServicePicker (items: content )
    
            sharingServicePicker.showRelativeToRect(button.bounds, ofView: button, preferredEdge: NSRectEdge.MaxY)
        }
    }
    

提交回复
热议问题