演示按预期工作,没有问题。但现在我正在尝试将它集成到我的项目中。我不使用xib-s,仅使用代码:
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 :(得分:0)
好的,问题似乎是我从ModalViewController-> NavigationController调用了[self presentModalViewController: controller animated: YES]
。这就是Cocoa触摸或Twitter-OAuth-iPhone(我真的不确切知道哪一个)有问题的地方。但这就是我需要的方式。
[self.navigationController pushViewController:controller animated: YES];
推送SA_OAuthTwitterController。
唯一剩下的问题是SA_OAuthTwitterController在内部创建了自己的NavigationController栏,所以现在我有2个导航栏可见。