gpt4 book ai didi

ios - 如何更改 UIActivityViewController 中的项目位置

转载 作者:行者123 更新时间:2023-11-28 20:02:16 25 4
gpt4 key购买 nike

如快照所示,如何将微信移动到底部,就像Line一样?

我浏览了来自此处的 LineActvity.m:https://github.com/OopsMouse/LINEActivity

但没有找到关于订单或位置的信息......

如何实现?

#import "LINEActivity.h"

@implementation LINEActivity

- (NSString *)activityType {
return @"jp.naver.LINEActivity";
}

- (UIImage *)activityImage
{
return [UIImage imageNamed:@"LINEActivityIcon.png"];
}

- (NSString *)activityTitle
{
return @"LINE";
}

- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems
{
for (id activityItem in activityItems) {
if ([activityItem isKindOfClass:[NSString class]] || [activityItem isKindOfClass:[UIImage class]]) {
return YES;
}
}
return NO;
}

- (void)prepareWithActivityItems:(NSArray *)activityItems {
for (id activityItem in activityItems) {
if ([self openLINEWithItem:activityItem])
break;
}
}

- (BOOL)isUsableLINE
{
return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"line://"]];
}

- (void)openLINEOnITunes
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/jp/app/line/id443904275?ls=1&mt=8"]];
}

- (BOOL)openLINEWithItem:(id)item
{
if (![self isUsableLINE]) {
[self openLINEOnITunes];
return NO;
}

NSString *LINEURLString = nil;
if ([item isKindOfClass:[NSString class]]) {
NSString *urlEncodeString = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes( NULL, (CFStringRef)item, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8 ));
LINEURLString = [NSString stringWithFormat:@"line://msg/text/%@", urlEncodeString];
} else if ([item isKindOfClass:[UIImage class]]) {
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithUniqueName];
[pasteboard setData:UIImagePNGRepresentation(item) forPasteboardType:@"public.png"];
LINEURLString = [NSString stringWithFormat:@"line://msg/image/%@", pasteboard.name];
} else {
return NO;
}

NSURL *LINEURL = [NSURL URLWithString:LINEURLString];
[[UIApplication sharedApplication] openURL:LINEURL];
return YES;
}

enter image description here

最佳答案

这很简单,你只需要在你的LineActivity.m类中覆盖一个方法

+ (UIActivityCategory)activityCategory
{
return UIActivityCategoryAction;
}

基本上有两个类别 UIActivityCategoryShareUIActivityCategoryAction 您可以根据需要使用更多详细信息,请参阅苹果文档 UIActivity Class Reference .

关于ios - 如何更改 UIActivityViewController 中的项目位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23445582/

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