Make An UIWebView Transparent

11 July 2017

I’ve been playing around with iOS. One challenge I came across was how to make a Web View transparent. I found two ways to do this: using the Interface Builder in Xcode or using Swift.

XCode

In XCode, go to the Attributes Inspector menu for the Web View and:

  • select “Clear Color” in the “Background” option
  • uncheck the “Opaque” option in the “Drawing” section

Attributes Inspector Menu Options

Swift

webView.isOpaque = false
webView.backgroundColor = UIColor.clear

Either way, the Web View will be transparent.

Note: I am using Xcode 8.3.3 and iOS 10.3

The kofi logo of a coffee mugLike this? Please buy me a coffee!

Share