方法如下:
let topView = UIView()
let bjViewImage = UIImage.init(named: "bg_shang")
// 設(shè)置 topView 的背景圖片
topView.layer.contents = bjViewImage?.CGImage
方法如下:
let topView = UIView()
let bjViewImage = UIImage.init(named: "bg_shang")
// 設(shè)置 topView 的背景圖片
topView.layer.contents = bjViewImage?.CGImage