6つのタブを追加するためのその他のソリューションも受け入れられます
5 つ以上のタブについては、CiExpandableTabBarController を使用しました 問題は次のとおりです。CiExpandableTabBarController を追加すると、次のようになります。それなら問題ない..
しかし、私はこれを2番目のビューとその後のビューに追加する必要があります..私の最初のビューはログインであるため、最初の後にビュータブバーが表示されるはずです
今、私は次のような出力を得ています:
選択した tebbar アイテムの画像が表示されない
しかし、私は次のような出力が必要です:
私はこのようなタブバーを追加しました:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self makeTabBar];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
//==============
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
}
else
{
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_3" bundle:nil];
}
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
}
UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController=nvc;
[nvc setNavigationBarHidden:YES];
// self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
-(void)makeTabBar
{
// self.tabBarController=[[UITabBarController alloc] init];
// self.tabBarController.customizableViewControllers = nil;
ProductSearchViewController *homeObj;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
homeObj=[[ProductSearchViewController alloc] initWithNibName:@"ProductSearchViewController" bundle:nil];
}
else
{
homeObj=[[ProductSearchViewController alloc] initWithNibName:@"ProductSearchViewController_3" bundle:nil];
}
}
else
{
homeObj=[[ProductSearchViewController alloc] initWithNibName:@"ProductSearchViewController~ipad" bundle:nil];
}
UINavigationController *tab1Controller = [[UINavigationController alloc] initWithRootViewController:homeObj];
tab1Controller.title=@"Product Seach";
tab1Controller.tabBarItem.image=[UIImage imageNamed:@"productsearch.png"];
WhereToBuyViewController *chatListObj;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController" bundle:nil];
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController_3" bundle:nil];
}
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController~ipad" bundle:nil];
}
UINavigationController *tab2Controller = [[UINavigationController alloc] initWithRootViewController:chatListObj];
tab2Controller.title=@"Where To Buy";
tab2Controller.tabBarItem.image=[UIImage imageNamed:@"wheretobuy.png"];
//===========tab3
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController" bundle:nil];
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController_3" bundle:nil];
}
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController~ipad" bundle:nil];
}
UINavigationController *tab3Controller = [[UINavigationController alloc] initWithRootViewController:chatListObj];
tab3Controller.title=@"Where To Buy";
tab3Controller.tabBarItem.image=[UIImage imageNamed:@"wheretobuy.png"];
//====================tab4
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController" bundle:nil];
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController_3" bundle:nil];
}
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController~ipad" bundle:nil];
}
UINavigationController *tab4Controller = [[UINavigationController alloc] initWithRootViewController:chatListObj];
tab4Controller.title=@"Where To Buy";
tab4Controller.tabBarItem.image=[UIImage imageNamed:@"wheretobuy.png"];
//==============tabtab5
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController" bundle:nil];
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController_3" bundle:nil];
}
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController~ipad" bundle:nil];
}
UINavigationController *tab5Controller = [[UINavigationController alloc] initWithRootViewController:chatListObj];
tab5Controller.title=@"Where To Buy";
tab5Controller.tabBarItem.image=[UIImage imageNamed:@"wheretobuy.png"];
//=========================tab 6
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568)
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController" bundle:nil];
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController_3" bundle:nil];
}
}
else
{
chatListObj=[[WhereToBuyViewController alloc] initWithNibName:@"WhereToBuyViewController~ipad" bundle:nil];
}
UINavigationController *tab6Controller = [[UINavigationController alloc] initWithRootViewController:chatListObj];
tab6Controller.title=@"Where To Buy";
tab2Controller.tabBarItem.image=[UIImage imageNamed:@"wheretobuy.png"];
//=======================
CiExpandableTabBarController *tabbar=[[CiExpandableTabBarController alloc] initWithViewControllers:[NSArray arrayWithObjects:tab1Controller,tab2Controller,tab3Controller,tab4Controller,tab5Controller,tab6Controller, nil] andSelectedIndex:0];
[self.window addSubview:tabbar.view];
}