gpt4 book ai didi

苹果手机 : How to Display Document Directory images in Image View?

转载 作者:太空狗 更新时间:2023-10-30 03:24:49 27 4
gpt4 key购买 nike

在文档目录文件夹中存储的应用程序图像,

我想在 ImageView 中显示特定图像,

该图像如何显示在文档目录中的 ImageView 中?

最佳答案

示例代码:

- (NSString *)applicationDocumentsDirectory {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}

-(void)loadimage{
NSString *workSpacePath=[[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"your image-name"];
UIImageView *myimage=[UIImageView alloc] initWithFrame:CGRectMake(0,0,20,20)];
myimage.image=[UIImage imageWithData:[NSData dataWithContentsOfFile:workSpacePath]];
[self.view addSubView:myimage];
[myimage release];
}

TQ

关于苹果手机 : How to Display Document Directory images in Image View?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6663511/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com