我的 View Controller 上方有容器 View
这个容器里装着xib,在这个xib里有照片
问题是照片是 png,我希望容器是透明的以显示我的 View 颜色
public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("TNImageCell", forIndexPath: indexPath) as! TNImageSliderCollectionViewCell
cell.backgroundColor = UIColor.clearColor()
cell.imageView.image = images[indexPath.row]
cell.labelSliderName.text = sliderNames[indexPath.row]
return cell
}
这个示例我是如何填充容器的
最佳答案
试试这个:tableView.backgroundColor = UIColor.clearColor()
和
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("TNImageCell", forIndexPath: indexPath) as! TNImageSliderCollectionViewCell
cell.backgroundColor = UIColor.clearColor()
cell.imageView.image = images[indexPath.row]
cell.imageView.alpha = 0.5
cell.labelSliderName.text = sliderNames[indexPath.row]
return cell
关于ios - 如何使容器 View 背景透明而不是一切?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36678603/