如何在山狮显示分享按钮? [英] How to show the share button in Mountain Lion?

查看:143
本文介绍了如何在山狮显示分享按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mountain Lion提供了一个内置的共享按钮,显示适合应用程序的共享服务菜单:

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

如何将其插入我的应用程序?

How can I insert it in my app?

推荐答案

要在Mountain Lion上添加共享按钮:

To add the share button on Mountain Lion:

1) strong>添加 NSButton 调用,例如 shareButton

2)为此按钮添加标准图片:

2) Add the standard image for this button:

[shareButton setImage:[NSImage imageNamed:NSImageNameShareTemplate]];
[shareButton sendActionOn:NSLeftMouseDownMask];

3) csh> c:NSSharingServicePicker :

3) Into the "on click action", present the NSSharingServicePicker:

NSSharingServicePicker *sharingServicePicker = [[NSSharingServicePicker alloc] initWithItems:urls];
sharingServicePicker.delegate = self;

[sharingServicePicker showRelativeToRect:[sender bounds]
                                          ofView:sender
                                   preferredEdge:NSMinYEdge];

4)最后,实现 NSSharingServicePickerDelegate 方法来自定义选择器的可用服务。

4) Eventually, implement the NSSharingServicePickerDelegate methods to customize the picker’s available services.

这篇关于如何在山狮显示分享按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆