我有垂直的收藏视图布局,并且确实修改了它的值:
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
var layoutAttributes = super.layoutAttributesForElements(in: rect) as! [UICollectionViewLayoutAttributes]
for attribute in layoutAttributes {
attribute.transform = affineTransformMakeShear(xShear: 0.0, yShear: -0.10510424)
}
return layoutAttributes
}
func affineTransformMakeShear(xShear: CGFloat, yShear: CGFloat ) -> CGAffineTransform {
return __CGAffineTransformMake(1, yShear, xShear, 1, 0, 0)
}
结果如下:
我想要的是计算顶部三角形的最低点和最高点之间的空白。
我尝试过:
let b = UIScreen.main.bounds.size.width * tan(degreesToRadians(degrees: 6.0))
它输出43,5,但实际上是61(我通过捕获屏幕截图进行了测量并在预览中查看了
)。我做错了什么?