简体   繁体   中英

iOS UITabBar : Remove top shadow gradient line iOS 10

Can anyone please give me solution for the UITabbar top shadow gradient line.i have tried with setting tabBar.shadowImage = nil shadowImage Customisation works for iOS 9 or prior. but not working for iOS 10.

For iOS 10 you can use below lines of in Application delegate class method didFinishLaunchingWithOptions :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

    [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"ImgName"]];
    [UITabBar appearance].layer.borderWidth = 0.0f;
    [UITabBar appearance].clipsToBounds = YES;

    return YES;
}

May be you can try below code, but is not recommended to use private API:

[self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];

Solution suggested by Shubham bairagi to Remove top shadow gradient line iOS 10 :

tabBar.subviews[0].subviews[1].isHidden = true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM