iphone - 在 UITabbar 项之间插入空格/ View /图像

标签 iphone ios ipad uitabbar

将一个应用程序移植到 ipad 上,在横向模式下,标签栏看起来有点稀疏,所以有了分隔标签(其中 6 个)并在它们之间插入图像的想法。

我目前使用的是 TabBarKit,它可以完成 UITabbar 所做的所有事情,但这是我一直坚持的事情。找不到任何方法来插入空白区域,无论是图像还是 UIView(背景已经是图像)?

到目前为止,我所做的是以编程方式添加几个额外的标签栏项,并将图像设置为 nil 并删除用户交互。 (我在另一个 stackoverflow 线程上找到了这个解决方案,但它不是一个完美的解决方案)。

我知道 UIToolbar 有一个灵活的空间项,但是当我尝试将其用作 tab bar 项 时,它导致了一些问题。

因此,如果有人对如何将 View 、空白空间等插入标签栏有任何想法,我们将不胜感激。

更新

开始悬赏,因为我很好奇这是否可以完成。 ipad 横向 View 有很多空间,我被要求在中间放置一个图像来分隔按钮。

如果该应用程序被拒绝,那么更多的是愚弄我。非常感谢任何示例、示例、建议、建议

图片示例: enter image description here

最佳答案

我同意上面的回答,这可能不是一个好主意,但从技术上讲,这是可能的。

自定义标签栏的诀窍是隐藏默认标签栏并将您自己的自定义 View 放在该空间中。然后你可以用按钮、图像,任何你想要的东西来填充那个 View 。以下是我的处理方式。

我在 AppDelegate 中这样设置我的 UITabbarController:

UITabBarController tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, 
                                             viewController2, 
                                             viewController3,
                                             nil];
//add the custom tabbarcontroller
CustomTabBar customTabBar = [[CustomTabBar alloc] initWithFrame:CGRectMake(0, self.window.frame.size.height - 60, self.window.frame.size.width, 62)];
    [self.tabBarController.view addSubview:_customTabBar];

tabBarController.tabBar.hidden = YES;
self.window.rootViewController = self.tabBarController;

CustomTabBar 是 UIView 的子类,我在其中放置了自己的自定义按钮。单击此类中的按钮时,我会发出如下所示的调用:

-(void)firstBtnClicked:(id)sender {
    ((UIButton*)sender).enabled = NO;
    AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
    delegate.tabBarController.selectedIndex = 0;
}

关于iphone - 在 UITabbar 项之间插入空格/ View /图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10654356/

相关文章:

iphone - iPhone 上什么速度更快? XML pList 还是 JSON?

iOS:移动版 Facebook 评论插件不断重新加载

ios - NSUrl 在 NSString 中带有超链接?

ios - 如何正确子类化 UIActionSheet

iphone - 核心数据查找表

iphone - 在 iPhone 上访问带有子域的本地网站

iphone - CoreLocation 每次都会请求许可

ios - 有什么办法知道是否通过 Apple Music 下载了歌曲?

ios - 在表格 View 右上角设置图像

html - iPad 上内容下方的空白