【发布时间】:2010-05-03 06:14:38
【问题描述】:
我对 Objective c 比较陌生,但不会编程,而且我的 iPhone 应用程序卡住了。
我创建了一个带有导航栏和标签栏控制器的基于导航的应用程序。我将标签栏设置为根控制器。我能够在每个选项卡之间切换,而对各种 UIView 和 UITableView 没有任何问题。
我的问题是,在我从 TabBarController 调用的 UITableViews 中,didSelectRowAtIndexPath 函数假设显示一个新的 UIView。下面的代码没有给出任何错误并且运行良好,但没有显示新的 Nib。
if(newViewController == nil) {
NSLog(@"yes nil");
BookViewController *aNewViewController = [[BookViewController alloc] initWithNibName:@"BookOptionView" bundle:nil];
self.newViewController = aNewViewController;
[aNewViewController release];
}
BookAppDelegate *delegate = (BookAppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.appNavBar pushViewController:newViewController animated:YES];
现在,当我执行以下操作时,它工作正常,但它摆脱了我假设的导航和选项卡,因为它是模态调用而不是推送视图控制器。
BookViewController *screen = [[BookViewController alloc] initWithNibName:@"BookOptionView" bundle:[NSBundle mainBundle]]; screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:screen animated:YES]; [screen release];
任何想法为什么我不能让视图控制器正确推送?在我的应用程序委托文件中,我声明了一个名为 appNavBar 的 AppNavBarController 对象(继承自 UINavigationController)。
任何帮助将不胜感激!
【问题讨论】:
标签: iphone uinavigationcontroller