SCNView角半径在设备上不起作用

问题描述 投票:0回答:1

[当我尝试设置cornerRadiusSCNView属性时,我没有得到预期的结果,即SCNView被舍入。它可以在模拟器上正常运行,但不能在设备上运行。我在装有iOS 13的iPhone SE和装有iOS 12的iPhone 7上进行了检查-两者的结果相同。我想知道在真实设备和模拟器上出现这种不同行为的原因是什么,如何使它在设备上运行?

ios ios-simulator scenekit radius
1个回答
-1
投票
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

}
© www.soinside.com 2019 - 2024. All rights reserved.