UIApplicationShortcutItem - 我可以使用从Web下载的图像作为UIApplicationShortcutIcon吗? [英] UIApplicationShortcutItem - Can I use an image downloaded from the web as UIApplicationShortcutIcon?
问题描述
我正在设置一些3D Touch功能,并且想要使用从网上下载的图像(可以通过 SDWebImage
的缓存访问)作为音频封面图片在 UIApplicationShortcutItem
中,就像Apple的音乐应用程序一样(见截图)。
I'm setting up some 3D Touch functionality and would like to use an image that has been downloaded from the web (can access via SDWebImage
's cache) as an audio cover image in a UIApplicationShortcutItem
, just like Apple's music app (see screenshot).
这可能吗?据我所知,它看起来并不是因为我无法将图像放入应用程序包中?我猜Apple正在做一些开发人员无法做到的事情?
Is this possible? It looks like it isn't as I can't put the image in to the app's bundle as far as I know? I guess Apple is doing something that devs can't do yet?
UIApplicationShortcutItem
的文档只有以下内容:
UIApplicationShortcutItem
's docs only have the following:
// Create an icon using a system-defined image.
+ (instancetype)iconWithType:(UIApplicationShortcutIconType)type;
// Create an icon from a custom image.
// The provided image named will be loaded from the app's bundle
// and will be masked to conform to the system-defined icon style.
+ (instancetype)iconWithTemplateImageName:(NSString *)templateImageName;
推荐答案
你是对的。目前,第三方应用程序无法(至少使用公共API)使用非模板图像,也无法下载图像并将其用作 UIApplicationShortcutIcon
。如果您希望在将来的版本中添加这些功能,请考虑在 bugreport.apple.com 。
You are correct. It is not currently possible (at least with the public API) for third-party apps to use a non-template image, nor is it possible to download an image and use it as the UIApplicationShortcutIcon
. If you would like to see these abilities added in a future release, please consider filing an enhancement request at bugreport.apple.com.
这篇关于UIApplicationShortcutItem - 我可以使用从Web下载的图像作为UIApplicationShortcutIcon吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!