gpt4 book ai didi

ios - 在 UIImageView 中显示本地镜像

转载 作者:IT王子 更新时间:2023-10-29 08:02:05 24 4
gpt4 key购买 nike

如何在 UIImageView 组件中显示来自硬盘的图像?

我有一个名为“images”的本地文件夹,想通过亲戚访问它路径,因为我想用应用程序打包图像。

最佳答案

要从驱动器上的某处加载图像,请使用:

UIImage * myImage = [UIImage imageWithContentsOfFile: @"../images/1.png"];

或者将图像添加到 Xcode 项目并使用:

UIImage * myImage = [UIImage imageNamed: @"1.png"];

然后将图像添加到 imageview:

UIImageView * myImageView = [[UIImageView alloc] initWithImage: myImage];

关于ios - 在 UIImageView 中显示本地镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6674597/

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