UISwitch Background Corner Radius

Originator:mkchoi212
Number:rdar://41235150 Date Originated:
Status:Open Resolved:
Product:UIKit Product Version:iOS 11.4
Classification:iOS + SDK Reproducible:Yes
 
To Reproduce:

https://gist.github.com/mkchoi212/63f2f6717859bf58dcdb52cf0d9bfb55

*Insert above code into a playground live view to see bug*

Area: UIKit

Summary:

When UISwitch's background is altered, the background color leaks out from UISwitch's view as the background's cornerRadius is not set properly.

Steps to Reproduce:

Create a contentView with a high contrast background color (to clearly see the difference).
Place a UISwitch with a background color different from that of the content view.

Expected Results:

The UISwitch's background view should be contained within the UISwitch.

Actual Results:

UISwitch's backgroundColor is applied to the backgroundView, which is a rectangle. The rectangle is then seen outside the UISwitch's borders.

Version/Build:

Xcode Version 9.4.1 (9F2000)
iOS 11.4

Configuration:

MacBook Pro (13-inch, 2016, Two Thunderbolt 3 ports)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!