我一直无法谷歌一个可以接受的解决方案,可以应用于我的项目.
我的应用程序是一个图形工具,有三个选项卡; 一个用于图表本身,另外两个用于浏览/搜索功能,可以添加到图表中.所有标签都是导航控制器.
图形本身的选项卡在纵向模式下显示图形的小预览,并列出下图中每个实体的详细信息,并在底部显示标签栏.
当用户旋转到横向模式时,图形将全屏显示,其他所有内容(包括标签栏)都会消失.这就是我遇到问题的地方,因为我的图表的GLView总是被标签栏所在的白色矩形遮挡.
我尝试将导航控制器视图的大小更改为全屏,将标签栏控制器视图的大小更改为全屏,将标签栏本身的框架大小更改为CGRect(0,0,0,0),变得情绪低落,在桌子上敲拳头,在MacBook上喊着辱骂语言等等; 一切都无济于事.
我怎样才能使它工作?
当用户选择标签栏项目时,我想要一种不同的背景颜色,而不是取消选择它时.
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, [UIScreen mainScreen].bounds.size.height ) style:UITableViewStylePlain];
Run Code Online (Sandbox Code Playgroud)
如果我将tableview框架更改为
(0.0, 0.0, 320.0, [UIScreen mainScreen].bounds.size.height -49.0)
Run Code Online (Sandbox Code Playgroud)
滚动条会留下空白,我不喜欢它.我怎么能解决这个问题?
非常感谢你.
注意:屏幕截图取自早期版本的iOS
码:
override func viewWillAppear(animated: Bool) {
// Creates image of the Button
let imageCameraButton: UIImage! = UIImage(named: "cameraIcon")
// Creates a Button
let cameraButton = UIButton(type: .Custom)
// Sets width and height to the Button
cameraButton.frame = CGRectMake(0.0, 0.0, imageCameraButton.size.width, imageCameraButton.size.height);
// Sets image to the Button
cameraButton.setBackgroundImage(imageCameraButton, forState: .Normal)
// Sets the center of the Button to the center of the TabBar
cameraButton.center = self.tabBar.center
// Sets an action to the Button
cameraButton.addTarget(self, action: "doSomething", forControlEvents: …
Run Code Online (Sandbox Code Playgroud) 我是iPhone开发的新手.我正在创建基于视图的应用程序.我在视图中添加了一个标签栏(而不是标签栏控制器).通过将标签栏项目的标签值设置为1,2,我已在tabbar项目单击事件上加载了每个标签栏的视图.
我希望默认选中标签栏1.我该怎么办?
这是我的代码:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
NSLog(@"didSelectItem: %d", item.tag);
[self activateTab:item.tag];
}
- (void)activateTab:(int)index {
switch (index) {
case 1:
self.tab1ViewController =[[tab1 alloc] initWithNibName:@"tab1" bundle:nil];
[self.view insertSubview:tab1ViewController.view belowSubview:tabbar1];
if (currentViewController != nil)
[currentViewController.view removeFromSuperview];
currentViewController = tab1ViewController;
break;
case 2:
self.tab2ViewController =[[tab2 alloc] initWithNibName:@"tab2" bundle:nil];
[self.view insertSubview:tab2ViewController.view belowSubview:tabbar1];
if (currentViewController != nil)
[currentViewController.view removeFromSuperview];
currentViewController = tab2ViewController;
break;
default:
break;
}
}
Run Code Online (Sandbox Code Playgroud)
我在界面构建器中添加了标签栏.我可以在界面构建器中执行任何操作吗?
我正在为我的UITabBarController的UITabBar添加徽章:
UITabBarItem *tbi = (UITabBarItem *)[stTabBarController.tabBar.items objectAtIndex:1];
tbi.badgeValue = @"2";
Run Code Online (Sandbox Code Playgroud)
但是,我的UITabBarController是可自定义的,因此索引可能会更改.如何确保徽章应用于正确的UITabBarItem?
我有一个问题,当我在TabBar上设置半透明盒子时,有些东西阻挡了我的一些视图.
它看起来像是一种额外的标签栏,或者我甚至都不知道.我正在使用故事板.
请看附图:
半透明(OFF - NO):
使用半透明(ON或YES):
有人知道它为什么会这样吗?
谢谢
PS:你喜欢哪个tabBar?黑色还是这个:
我知道这个问题也早先被问过,但我仍然没有得到任何解决方案在互联网上搜索解决方案.
我提到了以下帖子:
如何在iOS 7中更改tabBarItems的文本和图标颜色?
只能使用更改所选图标颜色tintColor
.
如何更改iOS 7中未选中的标签栏项目的颜色? 在这里,他们编写了自己的GozTabBar
继承自UIView 的类
我希望UITabBar
在处于未选择状态时更改图标的默认灰色.
任何帮助将受到高度赞赏.提前致谢.
我试图将股票UITabBar的高度更改为44px,类似于Tweetbot的标签栏高度.我也看到其他一些应用程序也这样做了.
但是,当我尝试设置高度时,它仍然保持不变
self.tabBar.frame.height = 40
Run Code Online (Sandbox Code Playgroud)
我们不允许更改标签栏高度吗?如果有的话,什么是好的选择呢?使用工具栏?
我一直试图在上周找到解决方案,在尝试了我能找到或想到的每一个可能的解决方案后,我没有运气.我发现并尝试过的每一个解决方案要么没有工作,要么已经过时了.
我有5 UITabBarItem
个UITabBar
放在里面UITabBarController
.我想要更改UITabBarItem
选择它时的背景颜色,当然还要在所选项目更改时更改.
我在Xcode 6.3.1中使用Swift和iOS SDK 8.3.如果您只能在Objective-C中回答也没问题,那么任何答案都会有所帮助!提前谢谢大家,我真的很感激!
编辑:这是我希望它做的一个视觉示例.
uitabbar ×10
ios ×5
iphone ×4
objective-c ×4
ios7 ×2
swift ×2
uitabbaritem ×2
cocoa-touch ×1
hidden ×1
ios8 ×1
uibutton ×1
uitableview ×1