iOS 7 tabBar-line, how to remove it?

前端 未结 12 1273
执笔经年
执笔经年 2021-01-31 07:52

Apple has added a tiny line over the tabBar in iOS 7 which is supposed to work as a shadow or fade between the tabBar and the UI

相关标签:
12条回答
  • 2021-01-31 08:24
        UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar_bg.png"];
        [[UITabBar appearance] setShadowImage:tabBarBackground];
        [[UITabBar appearance] setBackgroundImage:tabBarBackground];   
    
    0 讨论(0)
  • 2021-01-31 08:25

    now you can use it, with this line:

    self.tabBarController.tabBar.barStyle = UIBarStyleBlack; 
    
    0 讨论(0)
  • 2021-01-31 08:28

    These code works pretty well for me (I don't really have background image for tab bar):

    [tab_main.tabBar setBackgroundImage:[[UIImage alloc] init]];
    [[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
    

    And I use these code to add a frame too:

    UIColor* color_green = UIColorFromRGB(0x348e5b);
    tab_main.tabBar.layer.borderWidth = 0.50;
    tab_main.tabBar.layer.borderColor = color_green.CGColor;
    [[UITabBar appearance] setTintColor:color_green];
    

    Hope that helps.

    0 讨论(0)
  • 2021-01-31 08:28
    self.tabBarController =  [[UITabBarController alloc] init];
    [[[self tabBarController] tabBar] setBackgroundImage:[UIImage imageNamed:@"YOURIMAGE.png"]];
    [[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
    
    0 讨论(0)
  • 2021-01-31 08:29
     [_tabBarController.tabBar setBackgroundImage:[UIImage imageNamed:@"tabtarsprnt"]]; //your custom image
    [self.tabBarController.tabBar setClipsToBounds:YES];
    

    this code also solved the my issue

    0 讨论(0)
  • 2021-01-31 08:32

    Swift

    Nice simple solution:

    Write this below code in your custom tab bar class. Then it will hide horizontal shadow line.

    self.tabBar.setValue(true, forKey: "_hidesShadow")
    

    Objective C

    [self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];
    
    0 讨论(0)
提交回复
热议问题