Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

attodorov

macrumors newbie
Original poster
Apr 17, 2008
5
0
Hi guys,

Is there any way to make the background of a UIWebView transparent (i.e. clearColor)? I have tried everything I can think of - setting the backgroundColor to clearColor, setting transparency in the CSS itself, when I load HTML from a String, it just doesn't work - the background always stays white.

Actually if I set some other color than white (such as blue) in the HTML/CSS, the view background is correctly set to that color.

Is this some kind of bug? Because in the API docs, there is nothing mentioned that the background cannot be transparent.

What I really want to do is display rich text on a View. This is not possible with UITextView because it doesn't allow any attributed strings to be used - the text is only of one predefined font/color... So the only way is supposed to be UIWebView.

Thanks very much for your feedback.
 

MongoTheGeek

macrumors 68040
Hi guys,

Is there any way to make the background of a UIWebView transparent (i.e. clearColor)? I have tried everything I can think of - setting the backgroundColor to clearColor, setting transparency in the CSS itself, when I load HTML from a String, it just doesn't work - the background always stays white.

Actually if I set some other color than white (such as blue) in the HTML/CSS, the view background is correctly set to that color.

Is this some kind of bug? Because in the API docs, there is nothing mentioned that the background cannot be transparent.

What I really want to do is display rich text on a View. This is not possible with UITextView because it doesn't allow any attributed strings to be used - the text is only of one predefined font/color... So the only way is supposed to be UIWebView.

Thanks very much for your feedback.

The clear color may be working. What color is the the thing that the webview is on? Probably the NSWindow?

This one bit me before.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
On Mac OS X you can add a category to the WebView class to add the setDrawsBackground method to a web view and make the background transparent. I did this in a WebKit-based app a few months ago.

Code:
	@interface WebView (PRIVATE) 
 	(void)setDrawsBackground:(BOOL)flag; 
	(BOOL)drawsBackground; 
	@end

I wonder if something similar would work on Cocoa Touch?
 

macrumor.99

macrumors newbie
May 7, 2008
1
0
transparency in css

Is there any way to set the transparency in the css for mac Users. For example when I go to http://www.Clubpath.com and log in > go to clubs then select a nightclub and try to add it by clicking on the add button its seems to work there. But when I try to reproduce on my site it only works in ie and firefox.

Im sorry I can't produce an example of a site that dosnt require you be authenicated but this is the only site that I have seen it working on.
 

attodorov

macrumors newbie
Original poster
Apr 17, 2008
5
0
Hi guys,

Thanks for your replies - but please note that I have the iPhone SDK in mind, not pure Cocoa.

About CSS - there are several ways to set transparency using CSS but it doesn't seem to work in the UIWebView context.

Thanks,
Angel
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Has there been any updates on this? I'm wondering the same thing at the moment, since I need a transparent UIWebView.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.