【发布时间】:2011-04-12 18:33:41
【问题描述】:
我已经创建了一个 UItabbarcontroller 和 2 个带有 UITableViews 的视图,只使用代码(没有 IB 的东西),我现在想在顶部添加一个导航栏,其中包括添加和编辑按钮,但是我似乎正在绊倒和吹我的应用启动或仅将导航控制器添加到第三个选项卡。
这是我添加标签栏和切换视图的主要代码
仅供参考 - 我正在使用 XCode4
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.mainTabBar = [[UITabBarController alloc] init];
// create the 2 views
tableViewController* vc1 = [[tableViewController alloc] init];
tableViewController2* vc2 = [[tableViewController2 alloc] init];
// put them in an array
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
// for the tab bar
mainTabBar.viewControllers = controllers;
// Add the tab bar controller's current view as a subview of the window
[self.window addSubview:self.mainTabBar.view];
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
return YES;
}
【问题讨论】:
标签: iphone ios uitableview uinavigationcontroller xcode4