使用自定义数据自定义UIActivity

时间:2013-05-20 07:07:35

标签: uiactivityviewcontroller uiactivity

我有一些图片&我希望通过Facebook,Twitter分享的文字,它工作正常,虽然我想与我的自定义UIActivity分享另一组数据(activityitems)

 NSLog(@"The Selected Photo Count %i",[self.selectedPhotos count]);

NSMutableArray *newArray=[[NSMutableArray alloc]init];
NSMutableArray *newArraytext=[[NSMutableArray alloc]init];



for (Shoplog * ChosenPhot in self.selectedPhotos) {

    NSString *initalTextString = [NSString
                                  stringWithFormat:@"I am Sending from my Shoplog Collection: %@",
                                  ChosenPhot.categoryname];

    [newArraytext addObject:initalTextString];
    CreateShoplogTagImage *createimagetag=[[CreateShoplogTagImage alloc]init];
    UIImage *newimage=[createimagetag Imagetag:ChosenPhot];
    NSDictionary *flurrydicttionary3=[[NSDictionary alloc]initWithObjectsAndKeys:ChosenPhot.categoryname,@"SharedCategoryname", nil];
    [Flurry logEvent:@"SharedCatalogue" withParameters:flurrydicttionary3 timed:YES];
    [newArray addObject:newimage];

}


NSMutableArray *addArray=[[NSMutableArray alloc]initWithArray:newArray];
[addArray addObjectsFromArray:newArraytext];


UIActivityViewController *activityViewController2 =[[UIActivityViewController alloc]initWithActivityItems:addArray applicationActivities:@[shopactivity]];

[self presentViewController:activityViewController2 animated:YES completion:^{}];

1 个答案:

答案 0 :(得分:1)

您应该继承UIActivityItemProvider或创建符合UIActivityItemSource的对象。传入一组数组,并根据activityViewController:itemForActivityType:调用中选择的活动返回一些nil。