我中的UITabBar一样+ UINavigationController的应用程序,它经常从互联网上需要的数据。 有时需要相当长的一段它得到它之前,我想展现一个活动的指标。
我试图为一个activityView在我的applicationDidFinishLaunching方法添加到我的窗口:
[window addSubview:tabBarController.view];
fullscreenLoadingView.hidden = YES;
[window addSubview:fullscreenLoadingView];
然后,我添加的应用程序委托作为观察员默认的通知中心:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startFullscreenLoading:) name:@"startFullscreenLoading" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopFullscreenLoading:) name:@"stopFullscreenLoading" object:nil];
并实现方法:
- (void)startFullscreenLoading:(NSNotification *)notification {
fullscreenLoadingView.hidden = NO;
}
- (void)stopFullscreenLoading:(NSNotification *)notification {
fullscreenLoadingView.hidden = YES;
}
当我然后在的applicationDidFinishLaunching方法使用该直接的装载指示器视图显示UPP如预期:
[[NSNotificationCenter defaultCenter] postNotificationName:@"startFullscreenLoading" object:self];
但是,当我使用它的导航控制器之一的startFullscreenLoading:方法被调用,但我没有看到负载指示图。 这是为什么?