0

我有一個帶有三個選項卡/視圖控制器的tabbarcontroller。UIActivityIndi​​catorView無法正常工作(獲取影響UIActivityIndi​​catorView的Facebook權限)

當我第一次啓動我的應用程序時,我的ActivityIndi​​cator被設置爲可見和動畫 - 由界面構建器提供 - 它工作正常。

但是,當我點擊一個按鈕,一個互聯網窗口打開到Facebook,以獲得用戶的許可。

一旦Facebook部分被照顧後,它會返回到我的應用程序,但ActivityIndi​​cator不再是動畫 - 它仍然可見,但只是凍結。

如果我切換到另一個tab/viewcontroller,然後回到帶有ActivityIndi​​cator的tab/viewcontroller,一切正常。

有沒有辦法刷新我的ViewController,以便我不必以編程方式使ViewController來回切換?還是有其他建議?

/*我搜索了論壇,我看到了類似的問題。看起來有一個斷開的連接。因此,我將包含添加ViewController(即「控制器」到我的tabbarcontroller)的代碼。 */

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

    controller = [[DemoAppViewController alloc] init]; 
    controller.view.frame = CGRectMake(0, 20, 320, 460); 
    controller.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"movieAppBackground.jpg"]]; 
    MyTabBarViewController *vc2 = [[MyTabBarViewController alloc] init]; 
    SecondViewController *vc3 = [[SecondViewController alloc] init]; 

    controller.title = @"Intro Screen"; 
    vc2.title = @"Explore"; 
    vc3.title = @"Send a Pic"; 

    UITabBarController *tbc = [[UITabBarController alloc] init]; 
    tbc.viewControllers = [NSArray arrayWithObjects:controller, vc2, vc3, nil]; 
    self.theTBC=tbc; 

    [controller release]; 
    [vc2 release]; 
    [vc3 release]; 
    [tbc release]; 

    [self.window addSubview:tbc.view]; 
    [self.window makeKeyAndVisible]; 

    return YES; 

} 

回答

1

徘徊無論u必須使用NIB文件與viewcontrollers顯示u必須與initwithname

 SecondViewController *r=[[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil]; 

創造他們喜歡這種改變等。無論u必須使用榫文件創建實例,

我爲您創建的所有自定義視圖控制器提供了NIB文件

+0

謝謝@Vijay - 我一定會用initWithNibName :-)來初始化所有三個視圖控制器。但是,我確實嘗試了ViewController,它給了我一些問題,但它仍然沒有幫助。 – NateHill

+0

什麼是你的錯誤日誌帖子在這裏 –

+0

不知道這是檢查錯誤的正確方法,但我做了NSLog(@「%@」,aiView.hidden = NO);'它返回了'(NULL)這與我首先切換製表符時相同(即,當它動畫正確時) – NateHill

相關問題