gpt4 book ai didi

macos - OSX中是否有等效于UIActivityViewController的东西?

转载 作者:行者123 更新时间:2023-12-04 03:51:54 25 4
gpt4 key购买 nike

我正在将应用程序从iOS迁移到OSX,OSX中是否有等效于UIActivityViewController的东西。对于诸如Facebook,Twitter,邮件,消息共享之类的事情,我需要做类似的事情;

NSArray *activityItems = [NSArray arrayWithObjects:shareString, shareImage, shareUrl, nil];


UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

activityViewController.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll];


activityViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:activityViewController animated:YES completion:nil];

您如何在OSX中实现这一目标?

最佳答案

对于OSX,我们可以使用NSSharingServicePicker,它与iOS的UIActivityViewController非常相似:

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

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

关于macos - OSX中是否有等效于UIActivityViewController的东西?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21793208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com