Perf: remove unnecessary shadows and mask views

This commit is contained in:
James Magahern
2020-09-30 18:26:45 -07:00
parent 3769f5bbbf
commit fab8ccecbd
5 changed files with 19 additions and 9 deletions

View File

@@ -65,6 +65,8 @@ class ReliefButton: UIButton
backgroundView.layer.masksToBounds = true
backgroundView.layer.borderWidth = Self.borderWidth
backgroundView.layer.cornerCurve = .continuous
backgroundView.layer.shouldRasterize = true
backgroundView.layer.rasterizationScale = UIScreen.main.scale
addSubview(backgroundView)
traitCollectionDidChange(nil)
@@ -151,5 +153,8 @@ class ReliefButton: UIButton
}
shadowView.frame = backgroundView.frame
let shadowPath = UIBezierPath(roundedRect: shadowView.bounds, cornerRadius: Self.cornerRadius)
shadowView.layer.shadowPath = shadowPath.cgPath
}
}