Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/45.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 使用共享工具包发布图像_Iphone_Xcode_Sharekit - Fatal编程技术网

Iphone 使用共享工具包发布图像

Iphone 使用共享工具包发布图像,iphone,xcode,sharekit,Iphone,Xcode,Sharekit,我希望能够共享NSMutableArray中的所有图像,因此当用户查看他们想要共享的图片时,它将发送他们当前查看的图片,而不仅仅是阵列中的一张图片 UIImage *image = [UIImage imageNamed:@"Cats"]; SHKItem *item = [SHKItem image:image title:@"Take a look at this!"]; // Make the ShareKit action sheet SHKActionS

我希望能够共享NSMutableArray中的所有图像,因此当用户查看他们想要共享的图片时,它将发送他们当前查看的图片,而不仅仅是阵列中的一张图片

UIImage *image = [UIImage imageNamed:@"Cats"];
    SHKItem *item = [SHKItem image:image title:@"Take a look at this!"];

    // Make the ShareKit action sheet   
    SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

    // Display the action sheet
    [actionSheet showInView:self.view];

    // this is my array I want it my sharekit will respond to all the items in the array
    NSMutableArray *images = [[NSMutableArray alloc] initWithObjects:@"Cats.png",@"GWB.png",@"Australia.png",nil];  

基本上,我当前在UIImageview中查看的任何图片都将始终发送“cats.png”,但是,我希望它发送UIImageview中的任何图像。

如果您有一个显示3个不同图片(在不同时间)的界面,您应该在代码中的某个地方有一个对您的
UIImageview
的引用

上面发布的第一行完全按照您所说的做(使共享项成为cat png)。这是硬编码的,您应该通过将其更改为更具动态性来解决这一问题

// assume the reference to your UIImageView is myImageView
UIImage *image = myImageView.image;
.
.
.
使用此解决方案,您的共享方法不需要了解有关图像阵列的任何信息

此外

sharekit仅共享阵列中的一张图片,因为您使用cat png设置了该项目。即使您在发布的代码中设置了一个数组,该数组也不会以任何方式与sharekit交互。

请您再次查看您的问题。您的描述中似乎遗漏了一些内容:“这将发送他们当前查看的图片,而不仅仅是一张图片”我想共享阵列中的图像,我唯一能够共享的是一张使用以下内容的图片:UIImage*image=[UIImage imagename:@“Cats”];如何让sharekit共享我的arrayNo问题中的所有对象。我希望我的回答能让你明白为什么它能解决这个问题。