Swift: gradient on a cell of a tableview
问题 On tableView's cells, I'm trying to define a gradient with the following Swift code: func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { var cell:UITableViewCell = self.tableView?.dequeueReusableCellWithIdentifier("cell") as UITableViewCell cell.backgroundColor=UIColor.clearColor() let gradient : CAGradientLayer = CAGradientLayer() var arrayColors:Array<AnyObject> = [UIColor.blackColor().CGColor, UIColor.whiteColor().CGColor] gradient