UIApplicationShortcutItem - Can I use an image downloaded from the web as UIApplicationShortcutIcon?

大城市里の小女人 提交于 2019-12-04 21:43:41

问题


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).

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'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;

回答1:


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.



来源:https://stackoverflow.com/questions/33098000/uiapplicationshortcutitem-can-i-use-an-image-downloaded-from-the-web-as-uiappl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!