title: UITableViewCell loading wrong CAShapeLayer
body: <p>I have a weird behavior while loading background gradient depending on a date. 
  My code should change the background gradient of a uitableviewcell depending on an existing date. If a date is in past the background gradient turns red, yellow for present and green for future dates.
  So far, the code to get the correct state/gradient(red/yellow/green) works and will be displayed in console. Unfortunately not in the simulator/iPad.
  To insert the background gradient im using</p>
  
  <pre><code>cell.layer.insertSublayer(gradient, atIndex: 0)    
  </code></pre>
  
  <p>Here begins the weird behavior. While loading the next few cells the background gradient turns randomly red/yellow/green. 
  In fact when I'm using, </p>
  
  <pre><code>cell.layer.addSublayer(gradient) 
  </code></pre>
  
  <p>the gradients will be displayed correctly depending on the date, but the labels Outlets won't be displayed anymore</p>
  
  <pre><code>UITableViewCell:
  
  import UIKit
  
  class TaskUITVCell: UITableViewCell {
  
      @IBOutlet weak var appointment: UILabel!
      @IBOutlet weak var title: UILabel!
      @IBOutlet weak var creator: UILabel!
      @IBOutlet weak var assignedTo: UILabel!
      @IBOutlet weak var btnBookingCustomer: UIButton!
      var type:String = "-"
      var value:Int = 0
  
      override func awakeFromNib() {
          super.awakeFromNib()
      }
      override func setSelected(selected: Bool, animated: Bool) {
          super.setSelected(selected, animated: animated)
      }
      @IBAction func btnclicked(sender: AnyObject) {
          //TODO open User / Booking
          print("Type: \(self.type) Value: \(self.value)")
      }
  }
  </code></pre>
  
  <p>class TaskUITVC: UITableViewController</p>
  
  <pre><code>override func tableView(tableView: UITableView, cellForRowAtIndexPath     indexPath: NSIndexPath) -&gt; UITableViewCell {
  let cell = tableView.dequeueReusableCellWithIdentifier("TaskUITVCell", forIndexPath: indexPath) as! TaskUITVCell
  
  let due = overdueToActualDate(self.taskArray[indexPath.row])
  let gradient = Gradients().cellNormal(cell.bounds, tint: due)
  cell.layer.addSublayer(gradient)
  
  self.dateFormat.dateStyle = NSDateFormatterStyle.MediumStyle
  cell.title.text = self.taskArray[indexPath.row].title
  //Apointment Date
  cell.appointment.text =  self.dateFormat.stringFromDate(self.taskArray[indexPath.row].date)
  
  //Button: to choose correct type to open specific view controller
  
  if (String(taskArray[indexPath.row]) == "TaskModel"){
      cell.btnBookingCustomer.hidden = true
  }
  if (String(taskArray[indexPath.row]) == "CustomerTaskModel"){
      cell.btnBookingCustomer.setTitle("Customer: \((self.taskArray[indexPath.row] as! CustomerTaskModel).customer_number)", forState: .Normal)
      cell.type = String(taskArray[indexPath.row])
      cell.value = (self.taskArray[indexPath.row] as! CustomerTaskModel).customer_number
  }
  if (String(taskArray[indexPath.row]) == "BookingTaskModel"){
      cell.btnBookingCustomer.setTitle("Booking: \((self.taskArray[indexPath.row] as! BookingTaskModel).booking_id)", forState: .Normal)
      cell.type = String(taskArray[indexPath.row])
      cell.value = (self.taskArray[indexPath.row] as! BookingTaskModel).booking_id
  }
  return cell
  }
  </code></pre>
  
  <p>hopefully someone has a suggestion for this issue</p>
  
  <p>Edit: added screenshot of the behavior from the two methods
  Method insertSublayer displays the text, but background gradient is wrong. Methode addSublayer displays the gradient as expected, but no text 
  <a href="http://i.stack.imgur.com/DEu5C.png" rel="nofollow">Pic: left side addSublayer, right side insertSublayer at the same indexPath.row</a></p>
  
  <p>Somehow the pattern of the gradient in methods insertSublayer repeats.
  Maybe it's some coaching issue?</p>