所以,我在实现Three20 TTLauncherView时遇到了一些问题。我正在使用他们的代码,而不是一个分叉(虽然我听说过rodmaz的版本),但我无法让它正常工作。这就是我的应用程序的样子。
alt text http://img709.imageshack.us/img709/8792/screenshot20100715at409.png
我删除了图标图片,这不是问题。问题是,在顶部根本没有导航栏,我相信也会导致底部的白色条带,它看起来与导航栏的尺寸相同。我花了很长时间查看他们的代码,根本无法解决这个问题。看起来他们的导航栏(如他们的Catalog示例应用程序中所示)源于TTTableViewController,或更进一步的东西。但是,我的应用程序启动就像Facebook应用程序一样,而不是进入表格,而是进入TTLauncherView。那么......如果导航栏进入我的TTLauncher视图,如果它变为“App Delegate - > TTLauncherView Subclass”
感谢您的帮助!
编辑:
添加了我使用的代码。我把它放在我的app委托中,用UINavigation Controller包装我的第一个视图,它就像我想要的那样工作!
MainViewController *aController = [[MainViewController alloc] initWithNibName:nil bundle:nil]; //my Main view
self.mainViewController = aController;
[aController release]; //release for Memory Management
self.mainViewController.view.frame = [UIScreen mainScreen].applicationFrame;
UINavigationController *navigationController = [[UINavigationController alloc] init];
[navigationController pushViewController:self.mainViewController animated:NO]; //Gets the main view on the screen
[window addSubview:navigationController.view];
答案 0 :(得分:2)
您只需在推送新视图之前用导航栏包装视图。举个例子,这里是我的代码片段,其中我提供了一个带导航栏的模态视图控制器。
- (IBAction) showNewNavView: (id) sender
{
// Present it as a modal view and wrap the controller in a navigation controller to provide a navigation bar for the Edit and Save buttons
ModalViewController *addController = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
addController.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addController];
navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
[addController release];
}
如果您想添加任何按钮或设置其标题,您需要在您正在推送的视图的viewDidLoad
方法中执行此操作(即您的TTLauncher视图)