ios - UIApplicationShortcutItem - 我可以使用从网络下载的图像作为 UIApplicationShortcutIcon 吗?

标签 ios 3dtouch

我正在设置一些 3D Touch 功能,并想使用从网络下载的图像(可以通过 SDWebImage 的缓存访问)作为 中的音频封面图像code>UIApplicationShortcutItem,就像苹果的音乐应用(见截图)。

Apple Music screenshot

这可能吗?看起来不是,因为据我所知,我无法将图像放入应用程序的 bundle 中?我猜苹果正在做一些开发者还不能做的事情?

UIApplicationShortcutItem 的文档只有以下内容:

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

最佳答案

你是对的。第三方应用目前无法(至少在公共(public) API 中)使用非模板图像,也无法下载图像并将其用作 UIApplicationShortcutIcon。如果您希望在未来的版本中添加这些功能,请考虑在 bugreport.apple.com 提交增强请求。 .

关于ios - UIApplicationShortcutItem - 我可以使用从网络下载的图像作为 UIApplicationShortcutIcon 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33098000/

相关文章:

ios - 3D Touch Peek View 不会向上滑动进行操作

ios - UIApplicationShortcutIcon(模板图像名称: "imagename from .xcassets") showing black blank image

ios - 在 Swift 4 中在 Google map 上显示路径

ios - 从自定义 UIViewController 导航到 TabBarController 没有 segue

ios - UIActivityViewController 在 iOS 8 iPad 上崩溃

ios - React Native ios 选择器始终打开

ios - 我如何在 UiButton 操作中传递任何类型的参数?

ios - 自定义 UIApplicationShortcutIcon

ios - 悬停时如何删除 UIButton 的灰色外观

Swift 3D Touch 打开 TabBarController 而不是 RootViewController