Reputation: 4914
Activity indicator does not animate in my code. I have folowing code
How can i fix it? Is it because mean thread doesnt update indicator status? If so how can i fix it?
@interface ConnectionEstablishedViewController : UIViewController{
IBOutlet UIActivityIndicatorView * activityView;
IBOutlet UILabel *loadingLabel;
}
@property(nonatomic,retain) UIActivityIndicatorView * activityView;
I have assigned both label and activity indicator in my.xib file
.m
- (void) threadStartAnimating {
[activityView startAnimating];
loadingLabel.hidden=YES;
}
- (void) threadStopAnimating {
[activityView startAnimating];
loadingLabel.hidden=NO;
}
-(void)viewDidAppear:(BOOL)animated{
[self threadStartAnimating];
[NSThread sleepForTimeInterval:3.0];
[self hunttable];//call hunttable in order to fetch hunt table data
[NSThread sleepForTimeInterval:3.0];//sleep to prevent thread from overlap
[self huntingarea];
[NSThread sleepForTimeInterval:3.0];
[self stands];
[NSThread sleepForTimeInterval:3.0];
[self weapons];
[NSThread sleepForTimeInterval:3.0];
[self backpack];
[NSThread sleepForTimeInterval:3.0];
[self descriptionget];
[NSThread sleepForTimeInterval:3.0];
[self threadStopAnimating];
}
Upvotes: 0
Views: 2652
Reputation: 1553
I had similar problem
- (void)viewDidLoad
{
[super viewDidLoad];
[self threadStartAnimating];
}
-(void)viewDidAppear:(BOOL)animated{
.
...//functions
[self threadStopAnimating];
}
above should work
Upvotes: 3