ios - Stop activityIndicator in Embedded TableView Cell Upon Return From Detail ViewController -


i have viewcontroller has container view. in container view have tableview contains static cells. each cell has disclosure indicator. created in ib. parent viewcontroller embedded in navigationcontroller.

each cell pushes new view controller loads mapview. each map parses , loads .kml file. .kml files huge , take minute (or more) load.

i placed activityindicator in accessory view of each cell using following code:

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{  uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];  uiactivityindicatorview *activityview = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; [activityview startanimating]; [cell setaccessoryview:activityview];  [self.tableview deselectrowatindexpath:[self.tableview indexpathforselectedrow] animated:yes];} 

this appears work expected.

after viewing map touch "back" button provided navigationcontroller , pop map off stack. embedded tableview visible again, activity indicator still spinning. can't stop.

my best attempt in implementation file of tableview:

- (void)viewwillappear:(bool)animated{ [super viewwillappear:animated]; [[self tableview] reloaddata];} 

but didn't work. suggestions?

calling reloaddata in table view controller's viewwillappear work long in cellforrowatindexpath method, you're setting state uiactivityindicatorview calling it's stopanimating method (or remove view) cell shouldn't spinning.

you'll need reference activity indicator via accesstoryview property.

in data, store property indicates whether indicator should still spinning map , set appropriately.

another method stop activity indicator in prepareforsegue, prior showing map view.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -