gpt4 book ai didi

ios - 如何在不删除 ios 中的选项卡的情况下从选项卡栏 Controller 中删除 "more"选项

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:43:16 24 4
gpt4 key购买 nike

我正在使用选项卡栏 Controller ,当我在显示 4 个选项卡后运行应用程序时我有 6 个选项卡,并且有更多选项但在这里我想显示所有选项卡不想在 ios 7 中显示“更多”。代码是:

    UIViewController *viewController1 = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];

Calendar *viewController2 = [[Calendar alloc] initWithNibName:@"Calendar" bundle:nil];

nearby *viewController3 = [[nearby alloc] initWithNibName:@"nearby" bundle:nil];
offer *viewController4 = [[offer alloc] initWithNibName:@"offer" bundle:nil];
social *viewController5 = [[social alloc] initWithNibName:@"social" bundle:nil];
contact *viewController6 = [[contact alloc] initWithNibName:@"contact" bundle:nil];



UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController1];
UINavigationController *navController1 = [[UINavigationController alloc] initWithRootViewController:viewController2];
UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController:viewController3];
UINavigationController *navController3 = [[UINavigationController alloc] initWithRootViewController:viewController4];



self.tab = [[UITabBarController alloc] init];

self.tab.viewControllers = [NSArray arrayWithObjects:navController, navController1,navController2,navController3,viewController5,viewController6, nil];
[[self.tab tabBar] setBackgroundImage:[UIImage imageNamed:@"tabcrop.png"]];
self.tab.customizableViewControllers = nil;
[[[self.tab moreNavigationController] visibleViewController] setTitle:@""];

[self.tab.tabBar setTranslucent:YES];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"AmericanTypewriter" size:10.0f], UITextAttributeFont,
[UIColor yellowColor], UITextAttributeTextColor,
[UIColor redColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset,
nil] forState:UIControlStateSelected];
self.window.rootViewController = self.tab;

`

最佳答案

根据苹果文档,这是不可能的:https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/TabBarControllers.html

是这样写的:

If you add more than five items to the viewControllers property, the tab bar controller automatically inserts a special view controller (called the More view controller) to handle the display of the additional items. The More view controller provides a custom interface that lists the additional view controllers in a table, which can expand to accommodate any number of view controllers. The More view controller cannot be customized or selected and does not appear in any of the view controller lists managed by the tab bar controller. It appears automatically when it is needed and is separate from your custom content.

所以尝试自定义标签栏试试这个: https://github.com/Marxon13/M13InfiniteTabBar

关于ios - 如何在不删除 ios 中的选项卡的情况下从选项卡栏 Controller 中删除 "more"选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23356910/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com