Wait for a task to finish on other view
I'm developing an application where user needs to login first. It is actually a tabBar Application and I have loader a login view over it in the didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
method. This what i have done:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
// Override point for customization after application launch.
authView = [[AuthViewController alloc] init];
// Add the tab bar controller's view to the window and display.
[window addSubview:tabBarController.view];
[UIView beginAnimations:@"curldown" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:authView.view cache:YES];
[window addSubview:authView.view];
[UIView commitAnimations];
[window makeKeyAndVisible];
return YES;
[authView release];
}
What I want is First View controller to wait until this login view is removed. For more details, this how I removed the authView in authViewController:
[UIView beginAnimations:@"curlup" context:nil];
开发者_开发百科 [UIView setAnimationDelegate:self];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view.superview cache:YES];
[self.view removeFromSuperview];
[UIView commitAnimations];
Use NSNotification.
All the best.
Did you try to set up the delegate hierarchy? That might be helpful since what you actually need is communication between different controllers.
精彩评论