我有一个基于标签栏的应用程序。在应用委托中,我实现了:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
    if([viewController isKindOfClass:[TabBNavigationController class]]){
    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
    [nc postNotificationName:@"TabBClicked" 
    object:self userInfo:nil];}并发出通知。按tabB键时,将显示ViewB。ViewB位于UINavigationController内部。问题是ViewB的viewWillAppear在上述事件之前触发。我需要知道在ViewB的viewWillAppear触发之前,TabB是被点击的。在这种情况下,有没有其他方法可以领先于viewWillAppear?
发布于 2010-05-18 22:39:59
你有没有尝试过tabBarController:shouldSelectViewController:,这个方法应该在任何视图可见之前被调用。
https://stackoverflow.com/questions/2858209
复制相似问题