如同快照所示,如何将微信移至底部,就像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;
}
但没有找到关于订单或位置的信息......
如何实现目标?
{{1}}
答案 0 :(得分:3)
这很简单,您只需覆盖LineActivity.m
类
+ (UIActivityCategory)activityCategory
{
return UIActivityCategoryAction;
}
基本上有两个类别UIActivityCategoryShare
& UIActivityCategoryAction
您可以根据需要使用更多详细信息,请参阅苹果文档UIActivity Class Reference。