有没有办法阻止选项卡栏项目的配置?

发布于 2024-08-19 06:24:08 字数 112 浏览 5 评论 0原文

我构建了一个包含 5 个以上选项卡的选项卡栏,其余部分会自动添加到“更多”视图中。这很好,但除此之外,用户还可以“编辑”应用程序选项卡的配置。

我不希望用户能够这样做。有没有办法阻止用户这样做?

I constructed a tabbar with more than 5 tabs and the remainders were automatically added into the "More" view. That is fine, but along with that, the user is able to "Edit" the configuration of the app's tabs.

I do not want the user to be able to do that. Is there a way to prevent the user from doing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

为你鎻心 2024-08-26 06:24:08

查看 UITabBarController 文档。搜索“customizedViewControllers”

可定制的ViewController

管理的视图控制器的子集
通过这个标签栏控制器可以
定制。

@property(非原子,复制) NSArray
*可定制的ViewController

讨论

该属性控制哪些项目
标签栏可以通过以下方式重新排列
用户。当用户点击更多项目时
在标签栏视图上,自定义
出现显示任何项目的界面
不适合主选项卡栏。
该界面还包含一个编辑
按钮,允许用户
重新排列项目。仅项目
其关联的视图控制器是
在这个数组中可以重新排列
这个界面。如果数组为空
或者该属性的值为零,
标签栏不允许任何项目
重新排列。

改变的值
viewControllers 属性(或者
直接或使用
setViewControllers:animated: 方法)
也改变了这个值
财产。当第一次分配给
标签栏控制器,所有视图
控制器可通过以下方式定制
默认。

基本上,您要做的就是使用以下代码,将值设置为 nil:


- (void)applicationDidFinishLaunching:(UIApplication *)application
{
tabBarController.customizableViewControllers=nil;
}

干杯,
虚拟网络

Take a look at the UITabBarController documentation. Search for "customizableViewControllers"

customizableViewControllers

The subset of view controllers managed
by this tab bar controller that can be
customized.

@property(nonatomic, copy) NSArray
*customizableViewControllers

Discussion

This property controls which items in
the tab bar can be rearranged by the
user. When the user taps the More item
on the tab bar view, a custom
interface appears displaying any items
that did not fit on the main tab bar.
This interface also contains an Edit
button that allows the user to
rearrange the items. Only the items
whose associated view controllers are
in this array can be rearranged from
this interface. If the array is empty
or the value of this property is nil,
the tab bar does not allow any items
to be rearranged.

Changing the value of the
viewControllers property (either
directly or using the
setViewControllers:animated: method)
also changes the value of this
property. When first assigned to the
tab bar controller, all view
controllers are customizable by
default.

Basically what you have to do is use the following code, to set the value to nil:


- (void)applicationDidFinishLaunching:(UIApplication *)application
{
tabBarController.customizableViewControllers=nil;
}

Cheers,
VFN

笑叹一世浮沉 2024-08-26 06:24:08
// 'Move view' customization
// MORE tab bar items 'More view'
- (void)applicationDidFinishLaunching:(UIApplication *)application {
  self.tabBarController.customizableViewControllers=nil;

  UIViewController  * moreController =
  [[self.tabBarController.moreNavigationController viewControllers] objectAtIndex:0] ;
  UITableView * moreTableView = ( UITableView *)  [moreController view];
  [moreTableView setSeparatorColor:[UIColor redColor]];
  [moreTableView setBackgroundColor:[UIColor yellowColor]];
}
// 'Move view' customization
// MORE tab bar items 'More view'
- (void)applicationDidFinishLaunching:(UIApplication *)application {
  self.tabBarController.customizableViewControllers=nil;

  UIViewController  * moreController =
  [[self.tabBarController.moreNavigationController viewControllers] objectAtIndex:0] ;
  UITableView * moreTableView = ( UITableView *)  [moreController view];
  [moreTableView setSeparatorColor:[UIColor redColor]];
  [moreTableView setBackgroundColor:[UIColor yellowColor]];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文