uitableview - CAGradientLayer not shown until table cell is redrawn iOS 7 only -


on root view controller, have uitableview uses custom cells, uiimageview fills bounds of cell , has cagradientlayer added on top of create transparent gradient. works in ios 8. however, in ios 7, cells don't show cagradientlayer. if scroll down make cell out of view, scroll again come in view it's redrawn, cagradientlayer appears. ideas how can resolve this?

below code i'm using in custom cell:

override func awakefromnib() {     super.awakefromnib()     // initialization code     l = cagradientlayer()     l.frame = bandimageview.bounds     l.colors = [uicolor(red: 0, green: 0, blue: 0, alpha: 0).cgcolor, uicolor(red: 0, green: 0, blue: 0, alpha: 0.2).cgcolor, uicolor(red: 0, green: 0, blue: 0, alpha: 0.5).cgcolor, uicolor(red: 0, green: 0, blue: 0, alpha: 0.8).cgcolor]     bandimageview.layer.insertsublayer(l, atindex: 0) }  override func layoutsubviews() {     self.contentview.frame = self.bounds     l.frame = bandimageview.bounds } 

and in tableview:

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {         var cell: hometableviewcell = tableview.dequeuereusablecellwithidentifier("homecell") hometableviewcell         cell.bandimageview.clipstobounds = true         let bandimage = bandarray[indexpath.row]         cell.bandimageview.image = uiimage(named: bandimage)          return cell } 


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -