MOMMH MOMMH - 7 months ago 35
Swift Question

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

the problem is the photos is png and i want the container to be transparent to show me my view colour

enter image description here

enter image description here

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

Answer

Try this: tableView.backgroundColor = UIColor.clearColor() and

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
Comments