自定义iOS目标C的消息中心



我正在使用apptentive,并且我正在尝试自定义相同的消息中心。我想更改" apptentivecolorcontextbackground"颜色,但我无法从链接中弄清楚该链接的位置。用户可以修改UI。

任何帮助都会很棒。!

编辑: -

尝试了此

在AppTentiveMessAgeCenterviewController.m

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    switch ([self.dataSource cellTypeAtIndexPath:indexPath]) {
        case ATMessageCenterMessageTypeMessage:
        case ATMessageCenterMessageTypeCompoundMessage:
            [(ApptentiveStyleSheet *)Apptentive.shared.styleSheet setColor:[UIColor redColor] forStyle:ApptentiveColorMessageBackground];
            cell.contentView.backgroundColor = [[Apptentive sharedConnection].styleSheet colorForStyle:ApptentiveColorMessageBackground];
            break;
        case ATMessageCenterMessageTypeReply:
        case ATMessageCenterMessageTypeCompoundReply:
            cell.contentView.backgroundColor = [[Apptentive sharedConnection].styleSheet colorForStyle:ApptentiveColorReplyBackground];
        case ATMessageCenterMessageTypeContextMessage:
            [(ApptentiveStyleSheet *)Apptentive.shared.styleSheet setColor:[UIColor redColor] forStyle:ApptentiveColorContextBackground];
            cell.contentView.backgroundColor = [[Apptentive sharedConnection].styleSheet  colorForStyle:ApptentiveColorContextBackground];
    }
}

初始化时,Apptentive Singleton将其styleSheet属性设置为ApptentiveStyleSheet实例。

您可以修改一些内置的颜色属性(前景,背景等(,从中衍生出所有其他颜色。

您还可以覆盖特定的颜色(或字体(,如下(swift(:

if let style = Apptentive.sharedConnection().styleSheet as? ApptentiveStyleSheet {
    style.setColor(UIColor.red, forStyle: ApptentiveColorContextBackground)
}

或Objective-C:

[(ApptentiveStyleSheet *)Apptentive.shared.styleSheet setColor:[UIColor redColor] forStyle:ApptentiveColorContextBackground];

您需要在应用程序生命周期的早期中进行这些覆盖,例如在-application:didFinishLaunchingWithOptions:中。

您还可以创建实现ApptentiveStyle协议的对象(并将其设置在Apptentive Singleton上(,但是您必须进行子类ApptentiveStyleSheet或进行相当多的工作以返回所有的有效颜色和字体样式/颜色。

最新更新