uitableview - Remove UIActivityIndicator from cell content view when returning from detail view -
i have uitableview gets data internet when cell clicked displays uiactivity indicator , pushes detail view controller. when click uitableview cell clicked on has grey background , cell content no longer there.
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath
{ static nsstring *cellidentifier = @"tablecell"; tabelcell*cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];
_activityindicatorcell = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; // center of cell (vertically) int center = [cell frame].size.height / 2; int width = [cell frame].size.width / 1.1; // locate spinner in center of cell @ end of text [ _activityindicatorcell setframe:cgrectmake(width ,center - 9, 16, 16)]; [_activityindicatorcell sethidden:yes]; [[cell contentview] addsubview:_activityindicatorcell]; [ _activityindicatorcell startanimating]; [self.tableview deselectrowatindexpath:[self.tableview indexpathforselectedrow] animated:yes];
}
i added code remove uiactivityindicator still has grey box around cell clicked on , uilabel content no longer there.
- (void)viewwillappear:(bool)animated { [ _activityindicatorcell stopanimating]; [ _activityindicatorcell hideswhenstopped]; [self retrievedata]; }
i reload tableview in retrievedata method.
any ideas why isn't working ?
if add cell data in "numberofrowsinsection" method works correct?
also cell remains grey , not deselect though run:
[self.tableview deselectrowatindexpath:[self.tableview indexpathforselectedrow] animated:yes];
adding in did select method resolved issue:
[cell setselected:no animated:yes];
Comments
Post a Comment