Hi,
I am trying to pass a Hexadecimal color value from objectiveC to Javascript. I am displaying a graph and I am trying to pass the color to javascript so that I dont need to hardcode it in my html page.
Here is what I do -
In my .m File,
In my webViewDidFinishLoad function,
However, the javascript is not able to accept the values.
In my Javascript function, what should I do to accept the values - FFFFFF and 000000 so that I can use them.
I am trying to use the colors like this -
where instead of giving the hexadecimal values there, I would like to get it from objC.
It would be great if someone could help me out with this.
I am trying to pass a Hexadecimal color value from objectiveC to Javascript. I am displaying a graph and I am trying to pass the color to javascript so that I dont need to hardcode it in my html page.
Here is what I do -
In my .m File,
Code:
NSArray *colorArray = [NSArray arrayWithObjects:@"FFFFFF",@"000000", nil];
colorString = [[colorArray valueForKey:@"description"] componentsJoinedByString:@","];
In my webViewDidFinishLoad function,
Code:
[graphView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"methodName1([%@])", colorString]];
However, the javascript is not able to accept the values.
In my Javascript function, what should I do to accept the values - FFFFFF and 000000 so that I can use them.
I am trying to use the colors like this -
Code:
line1.Set('chart.colors', ['FF0000', '000000']);
where instead of giving the hexadecimal values there, I would like to get it from objC.
It would be great if someone could help me out with this.