ios - Avoid adding subview on cellforrowatindexpath -
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cellframe = cgrectmake(0, 0, tableview.frame.width, 100) var retcell = uitableviewcell(frame: cellframe) var textview = uitextview(frame: cgrectmake(8,30,tableview.frame.width-8-8,65)) textview.layer.bordercolor = uicolor.bluecolor().cgcolor textview.layer.borderwidth = 1 retcell.addsubview(textview) if(reqgrpindex == 0){ reqgrpindex = reqgrpindex + 1 } }
why shouldn't add subview on function?? how can change code practice doing same purpose?
you using function in wrong way.this function used initiate tableview cell , load data initiated table view cell.and it's practice reusable cells , load related information cell. way question has accepted answer , answer understand tableview concept well.and there nice tutorial explain tableview
Comments
Post a Comment