2012-01-02 3 views
0

4つのUIViewControllerを含むUITabBarControllerがあり、viewDidAppearの呼び出しが必要な場合は機能しません。なぜこれはiOS 4.3のためだけに起こるのではないですか?iOS 4.3でViewDidAppearを呼び出すと動作しませんか?

// 
UINavigationController *nav3 = [[UINavigationController alloc] init]; 
SearchViewController *searchViewController = [[SearchViewController alloc] init]; 
searchViewController.context = context; 

[nav3 pushViewController:searchViewController animated:NO]; 
[arrayViewController addObject:nav3]; 

[nav3 release]; [searchViewController release]; 

// 
UINavigationController *nav4 = [[UINavigationController alloc] init]; 
FavorisViewController *favorisViewController = [[FavorisViewController alloc] init]; 
favorisViewController.context = context; 

[nav4 pushViewController:favorisViewController animated:NO]; 
[arrayViewController addObject:nav4]; 

[nav4 release]; [favorisViewController release]; 

お気に入りのUIViewController:

 #pragma mark - View lifecycle 

    - (void)viewDidLoad 
     { 
     [super viewDidLoad]; 

      NSError *error; 
      NSFetchRequest *fetch = [[NSFetchRequest alloc] init]; 
      fetch.entity = [NSEntityDescription entityForName:@"Businesses" inManagedObjectContext:context]; 
      fetchObject = [context executeFetchRequest:fetch error:&error]; 

     [fetch release]; 

     } 

     - (void)viewDidAppear:(BOOL)animated 
     { 
      NSLog(@"test"); 
     } 

答えて

0

UINavigationController方法initWithRootViewController:代わりを使用してみてください。例えば、

FavorisViewController *favorisViewController = [[FavorisViewController alloc] init]; 
favorisViewController.context = context; 
UINavigationController *nav4 = [[UINavigationController alloc] initWithRootViewController:favorisViewController]; 
[favorisViewController release]; 

注意だけでなく、ビューがスタックにプッシュされるからといっていること、それは見えだという意味ではありません。そのビューでタブを選択するまで、viewDidAppear:は呼び出さないでください。

+0

これは機能しませんか? –

+0

iOS 5.0で動作しますか? –

関連する問題