ios - UITableView datasource methods get called only once -
my cellforrowatindexpath
doesn't updated after return detail view controller.
homeviewcontroller
- (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. self.title =@"welcome"; [eventstable registernib:[uinib nibwithnibname:@"eventcell" bundle:nil] forcellreuseidentifier:@"eventcell"]; //filtering process current date [self fetchusersfortype:1]; [eventstable reloaddata]; // configure bar button items.. uibarbuttonitem *filterbutton = [[uibarbuttonitem alloc]initwithtitle:@"filter" style:uibarbuttonitemstyleplain target:self action:@selector(filtertapped:)]; uibarbuttonitem *addbutton = [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action:@selector(addtapped:)]; self.navigationitem.leftbarbuttonitem = filterbutton; self.navigationitem.rightbarbuttonitem = addbutton; refreshcontrol= [[uirefreshcontrol alloc]init]; [eventstable addsubview:refreshcontrol]; //testing [refreshcontrol addtarget:self action:@selector(reloadtable) forcontrolevents:uicontroleventvaluechanged]; //performing async operation here [bottomview setframe:cgrectmake(0, self.view.frame.size.height-69, 320, 69)]; }
tableview datasource methods
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [self.eventsarray count];//1;//[sectioninfo numberofobjects]; } // customize appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"eventcell"; //testing eventcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; personevent *currentevent = [self.eventsarray objectatindex:indexpath.row]; [cell configureforevent:currentevent]; return cell; }
viewdidappear
-(void)viewdidappear:(bool)animated { [super viewdidappear:animated]; [[nsnotificationcenter defaultcenter]removeobserver:self]; [self reloadtable]; } - (void)reloadtable { nslog(@"reloading table view new contacts ."); [self fetchusersfortype:currentfilterindex]; [eventstable reloaddata]; [refreshcontrol endrefreshing]; nslog(@"observer finished."); }
since have used refresh control updates after refresh twice, problem?
i put breakpoints too,but cellforrowatindexpath
gets called first time, when select particular row , enter detail view controller , come cellforrowatindexpath
doesn't called.
Comments
Post a Comment