I am currently trying to activate an "Activity Indicator" on my view controller from a NSOBject class where I store global variables and global functions.
I put together this code below which is in on of the NSObject class functions. When I hit that function the Activity Indicator on my view does not animate. Please help.
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
ScreenUIViewController* vc = [sb instantiateViewControllerWithIdentifier:@"ScreenUIViewController"];
[vc.activeDisplay startAnimating];
In my NSObject class I have the functions declared as below in the .h file
+ (GlobalTest*)sharedGlobalTest;
// global function
- (void) testFunction;
In my NSObject And in the .m file I have
-(void)testFunction
{
NSLog(@"testFunction RAN!!");
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
ScreenUIViewController* vc = [sb instantiateViewControllerWithIdentifier:@"ScreenUIViewController"];
[vc.activeDisplay startAnimating];
}
I call it in a view controller by
[[GlobalTest sharedGlobalTest] testFunction];
Function does run, but the activity indicator does not aniamte
A little late to the game but thought I'd offer a suggestion.
If you have embedded your view controller in a navigation controller, one approach you can try is identifying the top view controller on the stack and presenting the activity view controller from there.
For example:
Again, maybe a little late to help you but it might be useful to someone else.
Cheers!