Apptentive Message单元格颜色更改

时间:2017-10-31 09:50:33

标签: ios objective-c uitableview iphone-x apptentive

您好我尝试自定义apptentive ApptentiveMessageCenterReplyCell ApptentiveMessageCenterContextMessageCell ApptentiveMessageCenterMessageCell 颜色,因为它被用作Storyboard中的单元格。在颜色变化时,我想更新其背景颜色,因为我无法使用SDK从styleSheet访问它。

iOS SDK版本:apptentive-ios 4.0.7

//示例代码

ApptentiveStyleSheet *style = [[Apptentive sharedConnection]styleSheet];
style.backgroundColor = self.isLightTheme ? [UIColor whiteColor] : [UIColor blackColor];
style.primaryColor = self.isLightTheme ? [UIColor blackColor] : [UIColor whiteColor];

在改变iPhone X风景中的颜色时遇到问题。无法改变所提到的细胞UITableViewCell的颜色..

1 个答案:

答案 0 :(得分:1)

目前,在第一次启动Message Center或Surveys后,样式表对象并不完全支持更改颜色。

但是,当您的应用主题发生变化时,您应该可以通过以下方式将样式表对象上的didInheritColors布尔属性设置为NO。使用键值编码。

这会导致样式表重新计算从主要颜色和背景颜色确定的各种中间颜色(您可能希望在显示消息中心时避免更改主题,因为它可能导致不一致颜色)。

另一种方法是使用-setColor:forStyle:在样式表对象上设置显式颜色覆盖,但是您必须对直接设置的颜色和从中计算的中间颜色执行此操作。