TSMessages icon indicating copy to clipboard operation
TSMessages copied to clipboard

Background non showing

Open licx opened this issue 10 years ago • 3 comments

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];

ios_simulator_-iphone_6-iphone_6___ios_8_1__12b411

licx avatar Dec 05 '14 19:12 licx

+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.

hbayraksan avatar Dec 15 '14 20:12 hbayraksan

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"
    }


licx avatar Dec 16 '14 07:12 licx

I had the same issue on iOS 8. Adding a custom design and removing the # worked for me. Thanks.

helkarli avatar Feb 24 '15 09:02 helkarli