我有一个包含四个 UIViewController 的 UITabBarController,当我想调用 viewDidAppear 时它不起作用。我不知道为什么这只发生在 iOS 4.3 上?
//
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");
}