当我将该图像提供给它不显示的按钮背景时,我有存储在 iphone 文档目录中的图像文件。
NSString*imageThumbnailVideo= [NSString stringWithFormat:@"%@thumbVideo.png",imageThumbnail];
NSLog(@"imageThumbnailVide is %@",imageThumbnailVideo);
NSString * filePath = [NSString stringWithFormat:@"%@/Documents/%@", NSHomeDirectory(),imageThumbnailVideo];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:filePath];
if (fileExists == 0)
{
NSLog(@"File is Not exists");
}
else
{
NSLog(@"File is present");
}
[thumbnailImageView setBackgroundImage:[UIImage imageNamed:imageThumbnailVideo] forState:UIControlStateNormal];
它还显示文件存在但不显示图像。
这是我保存文件的方式
testT=[NSString stringWithFormat:@"%@thumbVideo",titleTextField.text];
NSString *newStringVT = [testT stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString*imageTitleVT=[NSString stringWithFormat:@"%@.png",newStringVT];
NSString *pathVT = [documentsDirectory stringByAppendingPathComponent:imageTitleVT];
NSData*thumbVideoData=UIImagePNGRepresentation(thumbnail);
NSError * error = nil;
[thumbVideoData writeToFile:pathVT options:NSDataWritingAtomic error:&error];