等待任务完成其他视图

时间:2010-12-20 07:35:52

标签: iphone objective-c cocoa-touch xcode uiview

我正在开发一个用户需要先登录的应用程序。它实际上是一个tabBar应用程序,我在didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法中加载了一个登录视图。这就是我所做的:

- (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];
}

我想要的是First View控制器等待此登录视图被删除。有关更多详细信息,请参阅我在authViewController中删除authView的方法:

[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];

2 个答案:

答案 0 :(得分:4)

使用NSNotification

一切顺利。

答案 1 :(得分:0)

您是否尝试设置委托层次结构?这可能会有所帮助,因为您实际需要的是不同控制器之间的通信。