I have a view with a button, when you push that button you’re pushed to another view which is loading a webview. It loads a different url for each time you push the button. How can I add shadows to the webview while it’s loading the new url?
I have already tried
[myWebview.layer setShadowColor:[[UIColor blackColor] CGColor]];
[myWebview.layer setShadowOffset:CGSizeMake(1.0, 1.0)];
[myWebview.layer setShadowOpacity:1.0];
[myWebview.layer setShadowRadius:0.3];
But it doesn’t work. Can it be the values I pass to the different methods? This is in viewDidAppear, can that have something to do with it?
Try changing the shadows in the viewDidLoad of the WebView that you are pushing, and just disable them once you finish loading the WebView content.
It seems that what you may be running into is the fact that UIWebView’s layers are private. I’m guessing this is the case based on this answer: Problem in drawing UIWebView layer
In addition, if we look at the UIWebView class reference: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html it does not show any way to modify the webview layer. What is the effect you are trying to achieve with the shadow? Perhaps we can find some other solution for you.