简体   繁体   English

如何在基于标签的应用程序中永久隐藏“更多”栏

[英]How do I permanently hide the “More” bar in a Tab Based Application

First time Stackoverflow'er here, so bear with me... 第一次来Stackoverflow'er,所以请忍受...

I'm working on a Tab Based Application for the iPhone, and I have encountered a problem that I've been having trouble working out. 我正在为iPhone开发基于选项卡的应用程序,但是遇到了我在解决问题时遇到的问题。 I've been searching high and low for an answer, but it's one of those problems that is difficult to phrase succinctly. 我一直在寻找一个答案,但这是很难简洁表达的那些问题之一。 That makes getting useful search results difficult. 这使得很难获得有用的搜索结果。

In a nutshell, my Application will have more than five tab items in the bottom tab bar, resulting in the fifth tab item being labeled as "More...". 简而言之,我的应用程序在底部的标签栏中将有五个以上的标签项目,导致第五个标签项目被标记为“更多...”。 Tapping on that item then brings up a view with a bar at the top (UINavigationBar) that says "More", and a UITableView which lists the 5th, 6th and 7th item's titles and icons. 轻触该项目,然后弹出一个视图,该视图的顶部有一个栏(UINavigationBar),上面写着“更多”,还有一个UITableView列出了第五,第六和第七项的标题和图标。

Although I found a way to get rid of the top bar once a user has tapped on the 5th, 6th or 7th item, I would like that top "More" bar to never be displayed. 尽管我找到了一种方法,一旦用户轻按了第五,第六或第七项,就可以摆脱顶部的栏,但我希望顶部的“更多”栏永远不会显示。 In other words, the user taps on the "More..." tab item at the bottom and they see the UITableView with no bar above it. 换句话说,用户点击底部的“更多...”选项卡,他们会看到UITableView上方没有任何栏。 Ideally, I'd like to put my own custom header image above the list, but I just want to know if what I want to do is even possible first. 理想情况下,我想将自己的自定义标头图片放在列表上方,但我只想知道我想做的事是否甚至有可能首先实现。

Does anyone have any suggestions? 有没有人有什么建议?

Derive a class from UITabBarController , eg, MyTabController . UITabBarController派生一个类,例如MyTabController Use this class as tab controller, ie, assign it in the storyboard. 使用此类作为选项卡控制器,即在情节提要中分配它。 Hide in the initWithNibName of that controller the navigation bar of the moreNavigationController : moreNavigationController的导航栏中隐藏在该控制器的initWithNibName中:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
 {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
      // ... whatever you want
    self.moreNavigationController.navigationBarHidden=true;
  }
  return self;
}

The navigation bar won't appear. 导航栏不会出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM