如何在 iOS 10+ 中自定义通知的简短预览 [英] How to customize short preview of notifications in iOS 10+

查看:32
本文介绍了如何在 iOS 10+ 中自定义通知的简短预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经基于 本地和远程通知编程指南.

我观看了 WWDC 通知简介高级通知最佳实践,并阅读UNNotificationContentExtension.所有这些都表明我可以实现通知内容扩展来自定义通知呈现.但在我看来,他们似乎都假设我们只能自定义扩展视图(当我们按下 3D 短预览时打开的视图).

I watched WWDC Introduction to Notifications, Advanced Notifications, and Best Practices, and read UNNotificationContentExtension. All of these show that I can implement Notification Content extension to customize notification presentation. But to me it seems that they all assume that we can customize only the expanded view (the view that opens up when we 3D press the short preview).

现在我知道我可以以非常有限的方式自定义简短预览的呈现方式 - 使用标题/正文我可以决定是否需要粗体或普通字体;通过使用 通知服务扩展 我可以添加媒体预览.但是,我需要的是能够自己构建这个简短预览的 UI - 添加自定义 UIImageView 等.现在看来这是不可能的,但是我找不到任何明确的信息来证实这一点.

Now I know that I can customize the presentation of the short preview in a very restricted way - using title/body I can decide if I want a bold or normal font; by using Notification Service extension I can add a media preview. However, what I need is to be able to build the UI of this short preview myself - add custom UIImageView, etc. Right now it seems that this is not possible, but I wasn't able to find any explicit information that would confirm it.

所以我的问题是:我们可以自定义通知的简短预览吗?如果没有,官方文档中是否有任何明确的声明来解释这一点?如果是的话,你能给我推荐一些关于如何做的文档/教程吗?

So my question is: Can we customize the short preview of a notification? If not, is there any explicit statement in official docs that explain this? If yes, can you refer me to some docs/tutorials on how to do it?

推荐答案

我刚刚在自定义通知的外观文章 官方文档:

系统为缩写横幅提供界面,但您可以使用通知内容应用扩展自定义完整界面.

The system provides the interface for the abbreviated banner, but you can customize the full interface using a notification content app extension.

这证实了目前无法自定义短预览(文档中的缩写横幅").

This confirms that currently there is no way of customizing the short preview ("abbreviated banner" in the docs).

这篇关于如何在 iOS 10+ 中自定义通知的简短预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆