Open datomnurdin opened 9 years ago
Yeah, it is.
In the sample demo, you'll find the below code where the cells are being instantiated. Add the two lines to place icons.
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("CELL")
if (cell == nil) {
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: cellIdentifier)
cell!.backgroundColor = UIColor.clearColor()
cell!.textLabel?.textColor = UIColor.whiteColor()
let selectedBackgroundView = UIView(frame: CGRectMake(0, 0, cell!.frame.size.width, cell!.frame.size.height))
selectedBackgroundView.backgroundColor = UIColor.grayColor().colorWithAlphaComponent(0.2)
cell!.selectedBackgroundView = selectedBackgroundView
}
// Image for the cell ----> ADD THESE TWO LINES
let placeholderImage = UIImage(named: "sampleImage")! //sampleImage is the name of the image asset. Replace with your image.
cell!.imageView?.image = placeholderImage
// Text for the cell
cell!.textLabel?.text = "Text"
return cell!
}
Is it possible to place icons on left text on each UITableCellView?