Thursday, April 11, 2013

UIWebView and shadow

Last time I was trying to add a shadow to UIWebView. And it wasn't so obvious, because the standard way didn't work:

    webView.layer.shadowRadius = 8;
    webView.layer.shadowOffset = CGSizeMake(00);
    webView.layer.shadowColor = [[UIColor grayColorCGColor];
    webView.layer.shadowOpacity = 1;

But there is a simple solution. You just have to add these 2 lines:

    webView.layer.masksToBounds = NO;
    webView.layer.shadowPath = [[UIBezierPath bezierPathWithRect:webView.bounds] CGPath];


No comments:

Post a Comment