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

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

问题描述

我已基于我看了WWDC 通知简介

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

现在,我知道我可以以非常有限的方式自定义简短预览的显示方式-使用标题/正文,可以决定我要加粗字体还是普通字体;通过使用

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天全站免登陆