0

所以我刚刚升级到 Xcode 5,并将部署目标设置为 7.0。虽然我的应用程序看起来很棒,但我遇到了这个小问题。

在我的 ScreenshotViewController 的 init 中,我这样做:

pics = [[NSArray alloc] initWithContentsOfFile:[self dataFilePath]];

dataFilePath 方法蜂鸣:

- (NSString *)dataFilePath
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    return [documentsDirectory stringByAppendingPathComponent:@"screenshots.archive"];
}

在我的 UITableViewController 子类中,我初始化了一个 ScreenshotViewController(它基本上只是在 UIImageView 上显示一个图像),并设置它的图像。

ScreenshotViewController *ssv = [[ScreenshotViewController alloc]init];

[[self navigationController]pushViewController:ssv animated:YES];
NSInteger row = indexPath.row;
UIImage * pic = [UIImage imageWithData:[pics objectAtIndex:row]];

[ssv.image setImage:pic];

这在更新之前工作得很好,但现在 UIImageView 没有收到图像。我通过注意到执行此操作时不再将图像复制到我的相册中来检查这一点:

UIImageWriteToSavedPhotosAlbum(self.image.image, nil, nil, nil);

所以有什么建议可能发生了什么?

4

1 回答 1

0

通过以编程方式创建 UIImageView 来修复它。显然,自 ios 7 以来 UIImageView 有问题

于 2013-10-05T01:07:06.483 回答