我正在使用
IGListKit
用我的
UICollectionView
. 目前CollectionView非常简单,因为它每个部分只有一个单元格。该单元格包含一个内部水平
作为图像幻灯片放映。
因为我需要一些阴影围绕我的整个部分,我使用
Decoration Views
layer.shadowPath
我注意到一些奇怪的东西,阴影的不透明度改变了当前幻灯片中显示的图片。如果图片(或图片的一部分)是明亮的,您可以看到阴影不透明度的变化。
我不知道我能不能修好。
你可以清楚地看到,如果我在幻灯片中滑动图片时截图,顶部的阴影一侧会更暗。
装饰视图代码:
class FeedItemBackgroundShadowView: UICollectionReusableView {
// MARK: Initialization
... Constructors calling setup
// MARK: Setup
override func layoutSubviews() {
super.layoutSubviews()
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: Constants.cornerRadius).cgPath
}
func setup() {
self.layer.cornerRadius = 12.0
self.layer.backgroundColor = UIColor.white.cgColor
self.layer.shadowColor = UIColor.black.cgColor
self.layer.shadowOffset = CGSize(width: 0.0, height: 2.5)
self.layer.shadowRadius = 12.0
self.layer.shadowOpacity = 0.35
}
其余代码只是嵌入UICollectionView的UICollectionViewCells