0
嗨,我正在一个应用程序有一个登录窗体和另一个视图称为邀请。现在,我的继承人在登录按钮的我是来邀请视图与它看起来像这样UITabBar不显示
-(void)buttonPress { Invitation *obj = [[Invitation alloc]init]; [self.navigationController pushViewController:obj animated:YES]; }
现在邀请视图会发生什么代码的帮助下,打我的登录看法的问题是,我想要显示的TabBar所以我写它看起来像这样
objTabbar = [[UITabBar alloc]init];
HomeItem = [[UITabBarItem alloc]initWithTitle:@"Home" image:[UIImage imageNamed:@"house.png"] tag:0];
BluetoothItem = [[UITabBarItem alloc]initWithTitle:@"Bluetooth" image:[UIImage imageNamed:@"bluetooth.png"] tag:1];
NSArray *a = [[NSArray alloc]initWithObjects:HomeItem,BluetoothItem,nil];
objTabbar.items = a;
,并在的loadView方法我这样做
- (void)loadView {
[super loadView];
self.navigationItem.hidesBackButton = YES;
[self.view addSubview:objTabbar];
}
代码现在代码正在成功构建,但问题在于Tabbar没有显示出来。我试图tabbarController,这样做,
tabbarController.view = objTabbar;
,并在的loadView方法
[self.view addSubview:tabbarController.view];
但仍然没有成功加入tabbarController
请帮助我,让我知道我要去哪里错了 谢谢
你可以在IB创建你的TabBar吗?之后就是IB。 – 2010-11-10 11:59:56
@Richard:我知道我喜欢这样做,但我不用wana使用IB,我正在尝试通过代码来做到这一点,所以先生你有没有关于编码的建议?会很有帮助 – Radix 2010-11-10 12:14:22