Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-02-2010, 02:58 AM   #1 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 551
aldcorn@live.com is on a distinguished road
Default UIActivityIndicatorView

Hey Guys,
I have a table the starts an UIActivityIndicatorView (spinner) while an new view is being pushed based on a selected row. My app uses a navigation structure so when I press the back button my UIActivityIndicatorView (spinner) is still spinning.

How would I go about stopping this spinner when I navigate back to it?
Here is my code:
.m file where the spinner starts based on a row selection while pushing a new view:
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
[progressInd setHidesWhenStopped:YES];
[progressInd stopAnimating];
}
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	self.hidesBottomBarWhenPushed = YES;
	[tableView deselectRowAtIndexPath:indexPath animated:YES];
	
	if ([[fromPumpList objectAtIndex:indexPath.row] isEqual:@"One Hose Size"])
	{
		HandlinesViewController3 *detail = [[HandlinesViewController3 alloc] initWithNibName:@"HandlinesViewController3" bundle:nil];
		[detail setTitle:@"Discharge Pressure"];
		[self.navigationController pushViewController:detail animated:YES];
		[progressInd startAnimating];

	}	}
The code above does work to show the spinner.

The problem is when I navigate back to the view and the spinner is still spinning.

I have spent about an hour and a half trying to find an example to help me. I am still learning so if you have the time please help me place my stopAnimating code in the right place.

Thanks,
Rob
aldcorn@live.com is offline   Reply With Quote
Old 08-02-2010, 03:34 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Switzerland
Age: 26
Posts: 35
Shod is on a distinguished road
Default

you can implements these methods in your controller to get the desired behavior:

Code:
- (void)viewWillAppear:(BOOL)animated { }
- (void)viewWillDisappear:(BOOL)animated {}
- (void)viewDidAppear:(BOOL)animated {}
- (void)viewDidDisappear:(BOOL)animated {}
in your case you could put [progressInd stopAnimating] in viewWillAppear instead of viewDidLoad, so it get called every time the table will be displayed, stopping the spinning activity view when you navigate back.
Shod is offline   Reply With Quote
Old 08-02-2010, 03:37 AM   #3 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 551
aldcorn@live.com is on a distinguished road
Default YES

Ahhh! it feels so good.
Thanks for taking time to help me with this.

viewWillAppear works great.

Thanks again,
Rob
aldcorn@live.com is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 327
8 members and 319 guests
alexP, gordo26, headkaze, mistergreen2011, nobstudio, rayjeong, Sloshmonster, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:19 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0