addsubview - ios - I want to add View with CellFrame -


i add view in tableviewcell this.

-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {   uitableviewcell * cell = [[uitableviewcell alloc]init];   uiview * view = [[uiview alloc] initwithframe:cell.frame];   view.backgroundcolor = [uicolor redcolor];   [cell addsubview: view];  } 

i add view cell frame

but result enter image description here how do?

if create separate class , add view on show on full cell, if don't want create separate class cell use following code. in have set view width same table view width

 uitableviewcell * cell = [[uitableviewcell alloc]init];         uiview * view = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.tableview.frame.size.height, cell.frame.size.height)];         view.backgroundcolor = [uicolor redcolor];         cell.backgroundcolor =[uicolor purplecolor];         [cell addsubview: view]; 

i hope helps you!


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -