Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将我在应用程序中使用的所有图像放入同一个文件中,并通过密钥访问它们。
是否可以为此使用 .strings 文件?
是的,你可以!我用它来列出我的应用程序中使用的网站 URL。如果网站 URL 发生变化,这使得在应用程序中进行更改变得非常容易。这样做没有问题。
假设您的意思是要放置图像名称,是的,这是可能的。
在您的代码中,只需使用类似[UIImage imageNamed:NSLocalizedString(key, @"")];
[UIImage imageNamed:NSLocalizedString(key, @"")];
key指向图像名称的键在哪里。然后在 .strings 文件中,根据区域设置指向正确的图像文件。
key