UIActivityViewController:活动项目配置

时间:2013-01-15 20:33:24

标签: cocoa-touch uiactivityviewcontroller

我有一个UIActivityViewController,包含3种不同类型的活动项目。

NSStringUISimpleTextPrintFormatterUIImage

当我在推特,脸书或发送邮件时系统总是添加字符串和图像,但是当我打印系统时使用UISimpleTextPrintFormatter,除非我从NSArray中删除它。如何告诉UIActivityViewController使用UIImage代替打印?

NSString *textToShare
= [NSString stringWithFormat:@"%@ %@ %i",
   _car.make,_car.model, _car.constructionYear];

UISimpleTextPrintFormatter *textDataToShare
= [[UISimpleTextPrintFormatter alloc] initWithText:textToShare];

UIImage* imageToShare = [UIImage imageNamed:_car.picture];

NSArray* items = @[textToShare,imageToShare,textDataToShare];

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

1 个答案:

答案 0 :(得分:2)