UIImage中的路径参数imageWithContentsOfFile:用于XCAsset

 qianweirui7058 发布于 2023-02-10 12:06

imageWithContentsOfFile:如果图像存储在xcasset Bundle(Xcode 5 Image Catalog)中,有没有办法检索UIImage对象?

使用该imageNamed:方法可以轻松访问它,但imageWithContentsOfFile:行为略有不同,那么我在path参数中传递什么?

我试过使用各种格式,但它们都返回一个nil值:

ImageName@2x.png

ImageName @ 2倍

ImageName

NSBundle文件路径到图像

Apple的文档没有为此指定格式.有任何想法吗?

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有