Add view to cell in table view programmatically
I have a table view with dynamic prototypes that currently displays 4 items programmatically. I am assigning cell names through an array (see code below), but I also want to add a small view to the right half of each cell to show a small graph next to each label. I can take a look in the storyboard, but it doesn't propagate dynamically. Basically I need to find a way to modify this code to add a view inside each cell and assign the class I already created for those views.
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("LineCell", forIndexPath: indexPath) as! UITableViewCell
cell.textLabel?.text = oneLine.lineNames[indexPath.row]
return cell
}
This is where I need views:
Also, how can I make more space between Carrier, Time, Battery and the table view?
+4
source to share