且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取ios中当前的应用程序图标

更新时间:2022-12-22 12:57:50

我完全基于 moosgummi ',但返回 UIImage p>

I based my answer completely on moosgummi's, but returning a UIImage instead.

UIImage *appIcon = [UIImage imageNamed: [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIconFiles"] objectAtIndex:0]];

UIImage 自动选择合适的版本正常, @ 2x 〜ipad 〜ipad @ 2x 或任何未来的后缀)。 (BTW,你不是只是讨厌这个愚蠢的计划来识别图像的版本?它只是失控了。感谢上帝的资产目录!)

The UIImage automatically selects the suitable version (normal, @2x, ~ipad, ~ipad@2x or any future suffix). (BTW, don't you just hate this stupid scheme for identifying versions of images? It was just getting out of hand. Thank god for Asset Catalogues!)