2013-05-29 29 views
2

目前我有一個桌面視圖與從服務器填充的jpg圖像列表。當我選擇其中一個圖像時,顯示UIActivityController但是沒有選項可以保存到相機膠捲。唯一的選擇是分享到臉譜,推特,郵件等UIActivityViewController不顯示「保存到相機膠捲」選項

我想這樣我可以選擇將圖像保存到相機膠捲,也是另一個選項點擊「查看」,它會顯示它在一個新的詳細視圖。我主要希望能夠先保存到相機膠捲,然後再顯示詳細的視圖。

這是我到目前爲止的代碼。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath 
{ 
static NSString *CellIdentifier = @"Cell"; 

UITableViewCell *cell = [tableView 
         dequeueReusableCellWithIdentifier:CellIdentifier]; 


NSString *path = [NSString stringWithFormat:@"http://10.1.4.2:8080/DCIM/DCIM/VIDEOS/%@", [movieArray objectAtIndex:indexPath.row]]; 
NSString *ext = [[path pathExtension] lowercaseString]; 

if([ext isEqualToString:@"jpg"]) { 


    UIActivityViewController *objVC = [[UIActivityViewController alloc]initWithActivityItems:[NSArray arrayWithObjects:[NSURL URLWithString:path], nil] applicationActivities:nil]; 


    [self presentViewController:objVC animated:YES completion:nil]; 

} 

回答

2

如果你想要保存圖像,你需要傳入一個UIImage對象,而不是NSURL對象。請參閱this Stack Overflow answer中的示例代碼。

+0

儘管圖像對象來自url。它不在本地存儲在項目中。 @Aaron Brager – teejay

+0

@teejay是的。你需要下載它。 –

相關問題