From e8ade312d9110bd7f8d5480c7286bb55cefa20af Mon Sep 17 00:00:00 2001 From: Sino Date: Tue, 16 Feb 2016 16:48:24 +0100 Subject: [PATCH] possibillity to change text color as a styling option --- src/ios/Toast+UIView.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ios/Toast+UIView.m b/src/ios/Toast+UIView.m index 4d4cf1b..ea613b1 100644 --- a/src/ios/Toast+UIView.m +++ b/src/ios/Toast+UIView.m @@ -347,12 +347,15 @@ static id styling; } if (title != nil) { + NSString * titleLabelTextColor = styling[@"textColor"]; + UIColor *theTitleLabelTextColor = titleLabelTextColor == nil ? [UIColor whiteColor] : [self colorFromHexString:titleLabelTextColor]; + titleLabel = [[UILabel alloc] init]; titleLabel.numberOfLines = CSToastMaxTitleLines; titleLabel.font = [UIFont boldSystemFontOfSize:CSToastFontSize]; titleLabel.textAlignment = NSTextAlignmentLeft; titleLabel.lineBreakMode = NSLineBreakByWordWrapping; - titleLabel.textColor = [UIColor whiteColor]; + titleLabel.textColor = titleLabelTextColor; titleLabel.backgroundColor = [UIColor clearColor]; titleLabel.alpha = 1.0; titleLabel.text = title; @@ -364,11 +367,14 @@ static id styling; } if (message != nil) { + NSString * messageLabelTextColor = styling[@"textColor"]; + UIColor *theMessageLabelTextColor = messageLabelTextColor == nil ? [UIColor whiteColor] : [self colorFromHexString:messageLabelTextColor]; + messageLabel = [[UILabel alloc] init]; messageLabel.numberOfLines = CSToastMaxMessageLines; messageLabel.font = [UIFont systemFontOfSize:CSToastFontSize]; messageLabel.lineBreakMode = NSLineBreakByWordWrapping; - messageLabel.textColor = [UIColor whiteColor]; + messageLabel.textColor = theMessageLabelTextColor; messageLabel.backgroundColor = [UIColor clearColor]; messageLabel.alpha = 1.0; messageLabel.text = message;