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 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
Post a Comment