- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用这段代码创建一个带有透明孔的图层
let radius = min(self.view.frame.size.width,self.view.frame.size.height)
print(radius)
let path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height), cornerRadius: 0)
let circlePath = UIBezierPath(roundedRect: CGRect(x: 0, y: self.view.frame.size.height/2 - radius/2 , width: radius, height: radius), cornerRadius: radius/2)
path.append(circlePath)
path.usesEvenOddFillRule = true
fillLayer.path = path.cgPath
fillLayer.fillRule = kCAFillRuleEvenOdd
fillLayer.fillColor = UIColor.black.cgColor
fillLayer.opacity = 0.5
view.layer.addSublayer(fillLayer)
如果初始 View 是图像中显示的纵向或横向,它工作正常
但是,如果 View 从纵向变为横向或从横向变为纵向
如图所示,层的方向不正确
最佳答案
看起来您需要在用户旋转设备时更新路径框架。您正在寻找类似于 here 的答案.
如果您需要随着过渡设置动画,请尝试这样的操作:
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
coordinator.animate(alongsideTransition: { context in
// update frames here
}, completion: nil)
}
关于ios - 当 View 从纵向更改为横向时,调整带有透明孔的层的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52542359/
我想检测(并关闭)封闭网格的开口和孔洞/镂空部分。我知道对于一个开放的网格,这可以通过找到边界边(只属于一个三角形的边)来完成,如 here 所述。 . 但是对于不存在此类边界边的封闭网格呢?下面是一
我试过https://docs.konghq.com/getting-started-guide/2.1.x/expose-services/我也有本地服务器:kong/2.2.1我可以同时注册服务和
我在我的应用程序中使用 logback(SiftingAppender 和 RollingFileAppender)。每当请求进来时,它们将根据 url 查询中的 id 记录到不同的文件中。 这工作得
我在 ARKit 上遇到了一个问题,我需要帮助。我正在做一个小演示,我在场景中放置了一个简单的 SCNTorus 几何体,我试图将一个小球 (SCNSphere) 扔进环面孔中。问题是球在中间弹跳而不
编辑 经过更多研究但仍然没有解决方案,我添加了实质性编辑以及指向 .shp 文件的链接。 The shape file is included here 我有一个包含 9 个多边形的 SpatialP
有没有一种简单直接的方法可以使用 opencv 3.1 python 从图像中提取内部轮廓(孔)? 我知道我可以使用“区域”作为条件。但是,如果我更改图像分辨率,“区域”就不一样了。 例如,这张图片:
我正在审查 Angular 中的模板项目 引导组件有一个如下所示的 HTML 模板。很有道理。应用程序标题、应用程序侧边栏等标签将包含由带有匹配选择器的组件提供的内容。这一切都检查出来了。
案例场景: $ cat Status.txt 1,connected 2,connected 3,connected 4,connected 5,connected 6,connected 7,dis
我是一名优秀的程序员,十分优秀!