Ios 选项卡栏中的选项卡图标上出现意外行
我想使用比正常尺寸大的图像作为选项卡栏的图标,图像的高度高于选项卡栏 如果我在选项卡栏的初始化中初始化哪个图标更大的选项卡,图标上方会出现一条意外的线。代码如下:Ios 选项卡栏中的选项卡图标上出现意外行,ios,tabbar,Ios,Tabbar,我想使用比正常尺寸大的图像作为选项卡栏的图标,图像的高度高于选项卡栏 如果我在选项卡栏的初始化中初始化哪个图标更大的选项卡,图标上方会出现一条意外的线。代码如下: FirstViewController *FVC = [[FirstViewController alloc] init]; UIImage *image2 = [UIImage imageNamed:@"test75x75.png"]; FVC.tabBarItem = [[UITabBarItem alloc] init]; [
FirstViewController *FVC = [[FirstViewController alloc] init];
UIImage *image2 = [UIImage imageNamed:@"test75x75.png"];
FVC.tabBarItem = [[UITabBarItem alloc] init];
[FVC.tabBarItem setImage:[image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
SecondViewController *SVC = [[SecondViewController alloc] init];
SVC.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:2];
NSArray *array = @[FVC, SVC];
self.myTabbarController.viewControllers = array;
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:self.myTabbarController];
[self presentViewController:nvc animated:YES completion:^{}];
作为屏幕截图,选项卡栏的线条位于FVC图标上方(屏幕截图中的第一个选项卡)
但是如果我在选项卡栏初始化后添加了一个图标更大的新选项卡,
图标上方没有线条,请参见屏幕截图的第三个选项卡。
守则:
[self performSelector:@selector(updateTabbar) withObject:self afterDelay:2];
“updateTabbar”方法将第三个选项卡添加到选项卡栏中
我的问题是:
如果我想在选项卡栏的初始化中创建选项卡(具有较大的图标图像),如何隐藏图标上方的意外行
非常感谢
试试这个
self.tabBar.clipsToBounds = YES;
有关详细信息,请删除选项卡栏顶部的行。谢谢。但这不是我想要的。这句话使图标变小以适应选项卡栏,但我想保持图像的原始大小(图像大小高于选项卡栏的高度)。@abentotoro:将图像放入精确大小并进行调整。嗨,Vinesh TP,对不起,我不明白你的意思。第一个选项卡图像的大小与第三个图像的大小相同,但在第三个图像上方没有意外的线条。