How do UIWebView and UIScrollView manage RGB and hexa Colors?
I am encountering a strange problem :
I added a UIWebView
in a UIScrollView
. I tried to apply a background color for both.
For the
UIScrollView
I used Interface Builder and I specified a RGB coded color :255 0 0 (100% red)
.For the
UIWebView
I specified a Hexa coded color by using :[self.myWebView loadHTMLString:@"<style>body {background-color:#FF0000; color:#FFFFFF;}</style>text"];
Well, it seems the both item don't understand colors (which are equals : #FF0000
<=> RGB(255, 0, 0))
the same way.
UIScrollView
, and something which looks like a real 100% red in my UIWebView
.
Two important things :
- I do not apply any opac开发者_StackOverflowity or alpha property on both of
UIScrollView
andUIWebView
- When I try to specify
#000000
/RGB(0, 0, 0)
or#FFFFFF
/RGB(255, 255, 255)
, I get the exact same color in both of my View.
So here is my question :
Is there any difference between the way the both class manage colors ? Or any difference between RGB and Hexa colors ?There should be no difference. I just recreated you example and it does look exactly the same. Look at these screenshots below. I load the webview like this:
[self.webView loadHTMLString:
@"<html><body style='background-color:#FF0000; color:#FFFFFF;'>text</body></html>" baseURL:nil];
The color picker sets the color of the UIScrollView.
There must be something in your code or something about the webview and your css that alters the color.
精彩评论