TSMessages
TSMessages copied to clipboard
Background non showing
On iOs8 the background is not showing. I installed TSMessages 0.9.11 through Cocoapods. The Podfile platform version is iOs 7.0. The project deployment target is iOs 7.0.
Any idea on what could be causing the issue?
[TSMessage showNotificationInViewController:nav title:@"Hello" subtitle:@"Test" type:TSMessageNotificationTypeError duration:100000.0 canBeDismissedByUser:NO];
+1 I'm also having the same issue (with exact same config) although I was hoping it was a simulator issue. Currently can't test on real device.
I have some additional information. TSMessages loads the background colors from a default JSON configuration file. Those colors are in HEX format (Eg. "#AA317B"). For some reason when TSMessages passes the HEX color to the colorWithHexString
method of UIColor the method returns nil
. This method is part of the HexColor library
//Line 184 of TSMessageView.m
UIColor *c= [UIColor colorWithHexString:current[@"backgroundColor"]];
If the color is without the initial "#" the method works. For example "#aaabbb" doesn't work while "aaabbb" works. As quick workaround I created a custom JSON file with colors without the "#"
[TSMessage addCustomDesignFromFileWithName:@"TSMessagesCustomDesign.json"];
TSMessagesCustomDesign.json
"error": {
"backgroundImageName": "NotificationBackgroundError.png",
"borderColor": "700000",
"borderHeight": 1,
"buttonBackgroundImageName": "NotificationButtonBackground.png",
"buttonTitleTextColor": "FFFFFF",
"buttonTitleShadowColor": "812929",
"buttonTitleShadowOffsetX": 0,
"buttonTitleShadowOffsetY": -1,
"contentFontSize": 12,
"contentTextColor": "FFFFFF",
"imageName": "NotificationBackgroundErrorIcon.png",
"shadowColor": "812929",
"shadowOffsetX": 0,
"shadowOffsetY": -1,
"textColor": "FFFFFF",
"titleFontSize": 14,
"backgroundColor": "DD3B41"
}
I had the same issue on iOS 8. Adding a custom design and removing the # worked for me. Thanks.