2013-07-14 71 views
0

我正在使用集合视图控制器来显示缩略图。点击缩略图,segue以模态方式打开整个图像。它可以在模拟器上正常工作,但不能在我的iphone或ipad上正常工作。完整的图像是空白的。 “评论”出现在所有设备中。解析数据图像显示在iOS模拟器中,但不在设备中

这里的SEGUE:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 
    if ([segue.identifier isEqualToString:@"showBandPhoto"]) { 
     NSArray *indexPaths = [self.collectionView indexPathsForSelectedItems]; 
     BDBPhotoViewController *destViewController = segue.destinationViewController; 
     NSIndexPath *indexPath = [indexPaths objectAtIndex:0]; 

     PFObject *tempObject = [imageObjectsArray objectAtIndex:indexPath.row]; 
     PFFile *imageFile = [tempObject objectForKey:@"image"]; 
     NSData *imageData = [imageFile getData]; 
     UIImage *image = [UIImage imageWithData:imageData]; 
     destViewController.bandImageName = image; 
     NSLog(@"image is %@", image); 
     NSString *commentGet = [tempObject objectForKey:@"comment"]; 
     destViewController.comment = commentGet; 

下面是照片控制器的viewDidLoad代码:

self.photoImageView.image = bandImageName; 
    self.commentLabel.text = comment; 
+0

在检索数据之前segue是否完成?仍然不知道为什么模拟器可以工作。 – user2490500

回答

0

而不是使用UIImageView,请尝试使用PFImageView的。这个子类使得直接从Parse中加载图像数据变得更容易。

+0

尝试PFImageView,但没有改变。感谢您的建议。 – user2490500

0

我不知道为什么这个工作,但我将检索从Parse移到viewDidLoad并在那里创建图像数组。当调用segue时,它会从数组中获取图像,而不必查询Parse。

0

对我来说,问题是我在图像命名中添加了扩展名。模拟器可以读取图像,但不能读取设备。当我删除扩展它的工作。

此外,由于在这个岗位描述: images in iphone app appear in simulator but not when compiled to device

Mac文件系统不区分大小写和iOS的文件系统是大小写敏感的。由于图像命名,您的问题也许是正确的。

相关问题