[英]how to make container view background transparent only not everything?
I have container view above my view controller 我的视图控制器上方有容器视图
and this container hold xib and have photos in this Xib 这个容器盛放xib,在这个Xib中有照片
the problem is the photos is png and i want the container to be transparent to show me my view colour 问题是照片是png,我希望容器是透明的,以便向我显示我的视图颜色
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
}
this sample how i fill the container 这个样品我如何装满容器
Try this: tableView.backgroundColor = UIColor.clearColor()
and 试试这个: 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
您应该更改容器背景色的不透明度值,而不是alpha.Alpha值也将应用于所有子视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.