[当我尝试设置cornerRadius
的SCNView
属性时,我没有得到预期的结果,即SCNView
被舍入。它可以在模拟器上正常运行,但不能在设备上运行。我在装有iOS 13的iPhone SE和装有iOS 12的iPhone 7上进行了检查-两者的结果相同。我想知道在真实设备和模拟器上出现这种不同行为的原因是什么,如何使它在设备上运行?
override func viewDidLayoutSubviews() {
let mask = CAShapeLayer()
mask.frame = sceneView.bounds
mask.path = UIBezierPath(roundedRect: self.sceneView.bounds, cornerRadius: self.sceneView.frame.size.height/2).cgPath
self.sceneView.layer.mask = mask
self.sceneView.layer.masksToBounds = true
}