Reputation: 1251
How can i add a background image for UIWebView as a texture ? I use following code but its not working?
_webView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"light.jpg"]];
Upvotes: 1
Views: 5195
Reputation: 1251
Here is the solution
Add this line to viewDidload methode
[_webView setOpaque:NO];
Add this line to your IBAction methode
_webView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"light.jpg"]];
Upvotes: 6
Reputation: 2399
use below code
[_webView loadHTMLString:string baseURL:nil];
[_webView setOpaque:NO];
_webView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"light.jpg"]];
try this you will be succeed
Upvotes: 1