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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

android - Format a french phone number -