I have a UITabBar + UINavigationController application that often requires data from the Internet. Sometimes it takes quite a while before it works out, so I would like to show an activity indicator.
I am trying to add an ActivityView to my window in my applicationDidFinishLaunching method:
[window addSubview:tabBarController.view]
fullscreenLoadingView.hidden = YES;
[window addSubview:fullscreenLoadingView]
And then I add the application delegate as an observer to the default notification center:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startFullscreenLoading:) name:@"startFullscreenLoading" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopFullscreenLoading:) name:@"stopFullscreenLoading" object:nil];
and implement the methods:
- (void)startFullscreenLoading:(NSNotification *)notification {
fullscreenLoadingView.hidden = NO;
}
- (void)stopFullscreenLoading:(NSNotification *)notification {
fullscreenLoadingView.hidden = YES;
}
When I use this directly in the applicationDidFinishLaunching method, upp is displayed in the load indicator view as expected:
[[NSNotificationCenter defaultCenter] postNotificationName:@"startFullscreenLoading" object:self];
But when I use it from one of the navigation controllers, the startFullscreenLoading: method is called, but I do not see the type of the loading indicator. Why is this?