ios - Add view to a cell in a Table View Programatically -
i have table view dynamic prototypes displaying 4 elements programmatically. assign cell names through array (see code below), want add small view right half of each cell in order show small graph next each label. can drop in view in storyboard, doesn't extend dynamically. need find way modify code add view inside of each cell , assign class have created 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 want views:
also, how can make more space between carrier, time, , battery , table view?
you can create view want , add subview of cell's contentview:
var newview = uiview(frame: cgrectmake(200, 10, 100, 50)) cell.contentview.addsubview(newview)
Comments
Post a Comment