1

Hi I tried to customize apptentive ApptentiveMessageCenterReplyCell, ApptentiveMessageCenterContextMessageCell, ApptentiveMessageCenterMessageCell color since it is being used as cell in Storyboard. On color change i want to update its background color for that i could not access it from styleSheet using SDK.

iOS SDK version: apptentive-ios 4.0.7

//Example code

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

Facing issue in while changing color in iPhone X landscape. Could not able to change color for mentioned cells UITableViewCell..

Nagarjun
  • 6,557
  • 5
  • 33
  • 51

1 Answers1

1

Currently the stylesheet object doesn't fully support changing colors after Message Center or Surveys have launched for the first time.

However, when your app's theme changes, you should be able to set the didInheritColors boolean property to NO on the stylesheet object by e.g. using key-value coding.

This should cause the stylesheet to re-calculate the various intermediate colors that are determined from the primary and background colors (you'll probably want to avoid changing the theme while Message Center is being displayed, as it could cause inconsistent colors).

Another approach is to set an explicit color override on the stylesheet object using -setColor:forStyle:, but you would have to do this for both the directly-set colors and the intermediate ones that are calculated from those.

Frank Schmitt
  • 25,648
  • 10
  • 58
  • 70
  • What suppose to set in [style setColor:self.isLightTheme ? [UIColor lightTextColor] : [UIColor darkGrayColor] forStyle:?????]; – Nagarjun Nov 01 '17 at 07:32
  • The images [here](https://learn.apptentive.com/knowledge-base/interface-customization-ios/#using-your-own-style-sheet-object) list out the constants that you can use there. You probably want `ApptentiveColorMessageBackground`, `ApptentiveColorReplyBackground` , or `ApptentiveColorContextBackground` (these are defined at the end of `Apptentive.h`). Also there was a bug in SDK versions prior to 4.0.5 that didn't properly style reply cells, so make sure you're using the latest version (currently 4.0.7). – Frank Schmitt Nov 01 '17 at 18:22
  • thanks for SDK update for this. In release notes i see v4.1.1 is available but when i tried updating SDK using pod its is taking v4.0.9 reason? – Nagarjun Dec 21 '17 at 19:19
  • @Nagarjun Do you have a deployment target less than 9.0 in your podfile? 4.1.1 is for iOS 9 and greater (using Xcode 9 and newer). – Frank Schmitt Dec 22 '17 at 19:39
  • its targeted to ----> platform :ios, '9.0' – Nagarjun Dec 23 '17 at 16:13