2009-11-21 114 views
0

演示按預期工作,沒有問題。但現在我正試圖將其整合到我的項目中。我沒有使用xib -s,只有代碼:無法使Twitter-OAuth-iPhone正常工作

OAuthTwitterDemoViewController * vc = [[OAuthTwitterDemoViewController alloc] init]; [[UIApplication sharedApplication] .keyWindow addSubview:vc.view]; [vc release];

它編譯並運行時沒有錯誤,但實際的OAuthTwitterDemoViewController永遠不可見。我也試過它從自定義viewController與[self.view addSubview:vc.view]

什麼是祕密?


更新:

確定,這裏就是我與NavigationController:

TwitterAuthViewController *vc = [[TwitterAuthViewController alloc] init]; 

    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:vc]; 
    [vc release]; 

    [self presentModalViewController:navigationController animated:YES]; 
    [navigationController release]; 
+0

您是否嘗試將視圖控制器推送到導航控制器?你的其他觀點是否正確顯示? – 2009-11-21 14:32:29

+0

很快,本!是的,UINavigationController幫助了很多 - 我可以看到TwitterAuthViewController的視圖。但現在我得到了EXC_BAD_ACCESS ...將嘗試調查問題。 任何想法爲什麼它從UINavigationController工作,而不是我以前做過的? – cocoapriest 2009-11-21 14:39:56

+0

順便說一句,我更新了代碼 – cocoapriest 2009-11-21 14:40:36

回答

0

OK,問題似乎是,我叫[self presentModalViewController: controller animated: YES]從ModalViewController-> NavigationController。這就是Cocoa touch或Twitter-OAuth-iPhone(我真的不知道究竟是哪一個)出現問題的地方。但這是我需要的。

正如Ben所說的,解決方案就是推動SA_OAuthTwitterController,如[self.navigationController pushViewController:controller animated: YES];

剩下的唯一問題是SA_OAuthTwitterController在內部創建自己的NavigationController欄,所以現在我有2個導航欄可見。

+0

SA_OAuthTwitterController應該能夠以模態形式使用;擺脫您的重複的導航欄,只需發送一個導航控制器的一個--setNavigationBarHidden:消息。 – 2009-11-21 15:33:41