所以,我目前正在通过这种方法将图像保存在我的 UIImageView 中:
- (void)applicationDidEnterBackground:(UIApplication*)application {
NSString *image1 = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/image1.png"];
NSString *image2 = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/image2.png"];
}
图像保存得很好,但我不知道如何在 viewDidLoad 中设置 UIImageViews 图像。这是我一直在尝试的:
- (void)viewDidLoad
{
self.imageView.image =[UIImage imageNamed:[(NSHomeDirectory *)Documents objectForKey:@"image1"]];
self.imageView2.image =[UIImage imageNamed:[(NSHomeDirectory *)Documents objectForKey:@"image1"]];
}
但是,显然这是行不通的。我无法理解这里的基础知识。任何帮助都会很棒,谢谢!