Vis*_*hal 8 iphone objective-c uipasteboard ios
我已成功地使用以下代码将图像复制或添加到粘贴板:
if (ver_float < 6.0)
{
UIPasteboard *pasteboard;
pasteboard = [UIPasteboard generalPasteboard];
NSString *filePath =pathToImage;
[pasteboard setImage:[UIImage imageWithContentsOfFile:filePath]];
}
else
{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSString *filePath =pathToImage;
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
[pasteboard setData:videoData forPasteboardType:[UIPasteboardTypeListImage objectAtIndex:0]];
}
NSURL *urlstr = [NSURL URLWithString:@"sms:"];
[[UIApplication sharedApplication] openURL:urlstr];
Run Code Online (Sandbox Code Playgroud)
但我正在制作的应用程序基于图像和视频,以便用户可以通过imessage或messagecomposer发送图像/视频.但是因为我已将图像转换为数据并添加到粘贴板中.它正在成功地工作并通过imessage发送.但我还需要通过imessage发送视频.如果有人对此有任何想法,请提供一些建议或解决方案.
我非常感谢你的帮助.
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://pathto.mp4"]];
UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard];
[pasteBoard setData:data forPasteboardType:@"public.mpeg-4"];
Run Code Online (Sandbox Code Playgroud)
@"public.mpeg-4"来自http://www.escape.gr/manuals/qdrop/UTI.html
| 归档时间: |
|
| 查看次数: |
2034 次 |
| 最近记录: |