WatchKit 通知框颜色 [英] WatchKit Notification Sash Color
问题描述
我在情节提要中设置了通知框颜色,它在模拟器中运行良好,但在我的手表上显示为灰色.有谁知道这是否是一个已知问题,或者您是否需要在运行时在真实设备上执行某些操作以正确显示颜色?
I've set my notification sash color in storyboard and it works fine in the simulator, but it shows up as gray on my watch. Does anyone know if this is a known issue or do you need to do something at runtime on a real device to show the color properly?
推荐答案
窗扇颜色是为情节提要中的 WKNotificationCategory 设置的,它有一个名称.(在您的屏幕截图myCategory"中).然后,为了在真实设备上显示正确的腰带颜色,推送通知需要在您发送时具有匹配的类别名称.
The sash color is set for the WKNotificationCategory in the storyboard, which has a name. (In your screenshot "myCategory"). Then, for the correct sash color to appear on the real device, the push notification needs to have the matching category name when you send it.
UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification) {
notification.alertBody = @"Hello";
notification.category = @"myCategory";
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
这篇关于WatchKit 通知框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!