简体   繁体   中英

How to apply custom font/color and semi-transparent background for my custom view in notification content extension?

I implemented Notification content extension for customizing my push notification alert. I got the alert like the following image.

在此处输入图片说明

But I would like to apply following things to my custom view

1: How to make blurred/semi-transparent background for custom view ?

2: How to apply custom fonts (already used in my application )for different labels in this custom view ?

3: How to apply different colors for views from my custom color class ?

I already added custom font to my application target.But I cannot access these fonts to my custom view used in extension. Please help me how to solve these issues?

  1. I'm not sure what you mean by blurred? Do you want to blur the entire background of the notification? That is not possible I'm afraid.

  2. Here is a good article explaining the steps you need to take to include a custom font into multiple targets (your main app being one target, and your extension being another). My guess is that you have not included it in your extensions .plist as well.

  3. The same is also true for your custom color class. However, if your custom color class is dependent on other classes, they will need to be added to the extension target as well, which can be a deep rabbit hole to go down. If that's the case, either try to get rid of some dependencies or in worst case, just replicate the custom color class in your extension.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM