【问题标题】:Wait for a task to finish on other view在其他视图上等待任务完成
【发布时间】:2010-12-20 07:35:52
【问题描述】:

我正在开发一个用户需要先登录的应用程序。它实际上是一个 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];

【问题讨论】:

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


    【解决方案1】:

    使用NSNotification

    一切顺利。

    【讨论】:

    • 嗨,你能告诉我如何使用 NSNotification 来实现吗?我尝试了自己,但无法成功。 :(
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2013-05-26
      • 1970-01-01
      • 1970-01-01
      • 2012-07-23
      • 1970-01-01
      • 2012-05-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多