iphone - IOS: Clear Previous content in Modal viewcontroller -
in application, have used 1 modal viewcontroller contains 1 tableview multiple textfields.
say main viewcontroller called sridharviewcontroller , modal viewcontroller called resultsviewcontroller
there 1 button in sridharviewcontroller , touching button open modal(resultsviewcontroller)
[self presentmodalviewcontroller:resultsviewcontroller animated:yes];
and in results view controller , there many text fields aligned in tableview. , 1 'ok' button . pressing 'ok' button dismiss modal
[self dismissmodalviewcontrolleranimated:yes]; - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nslog(@"cellforrowatindexpath called"); static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; } //uitextfield *formtextfield = [[uitextfield alloc] initwithframe:cgrectmake(30, 11, 270, 30)]; uitextfield *formtextfield =nil; if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if(indexpath.row == 0){ formtextfield = [[uitextfield alloc] initwithframe:cgrectmake(30, 12, 270, 30)]; } else{ formtextfield = [[uitextfield alloc] initwithframe:cgrectmake(30, 11, 270, 30)]; } }else{ if(indexpath.row == 0){ formtextfield = [[uitextfield alloc] initwithframe:cgrectmake(50, 12, 670, 30)]; } else{ formtextfield = [[uitextfield alloc] initwithframe:cgrectmake(50, 11, 670, 30)]; } } formtextfield.placeholder = [self.formfields objectatindex:indexpath.row]; formtextfield.tag = indexpath.row; formtextfield.text=@""; formtextfield.adjustsfontsizetofitwidth = yes; formtextfield.textcolor = [uicolor blackcolor]; formtextfield.borderstyle = uitextborderstylenone; formtextfield.keyboardtype = uikeyboardtypenumbersandpunctuation; [formtextfield setautocapitalizationtype:uitextautocapitalizationtypenone]; [formtextfield setautocorrectiontype:uitextautocorrectiontypeno]; formtextfield.backgroundcolor = [uicolor clearcolor]; formtextfield.textalignment = uitextalignmentleft; formtextfield.delegate = self; [formtextfield setenabled: yes]; [formtextfield setreturnkeytype:uireturnkeynext]; [self.textfields addobject:formtextfield]; [cell addsubview:formtextfield]; return cell; }
when calling modal view second time , modal shows previous content. want clear previous content. have tried both updates , reload functions. none of them calling cellforrowatindexpath
method.
[self.thetable reloadinputviews];
please provide me best way this.
in viewwillappear
following
arrayofinputs = [nsarray array]; [self.tableview reloaddata];
where arrayofinputs
store objects display on tableview. after making data source empty , reload table view, contents clear. can reload table view required data.
Comments
Post a Comment