简体   繁体   中英

How to set navbar and tabbar not transparent and their borders visible

I can not find any info in internet about this question. I have tableview in UIViewcontroller and it is embedded in navigation controller. I want that my navbar was always like in scrolling state (borders are visible) and same thing with tabbar. Here is photo what I have(1-st) and what I want (2-nd).

在此处输入图像描述

在此处输入图像描述

In AppDelegate file in didFinishLaunchingWithOptions method added:

        //MARK: - NavBar appearance
        let navBarAppearance = UINavigationBarAppearance()
        navBarAppearance.backgroundColor = UIColor(named: "AccentColor")
        UINavigationBar.appearance().standardAppearance  = navBarAppearance
        UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
        
        //MARK: - TabBar appearance
        let tabBarAppearance = UITabBarAppearance()
        tabBarAppearance.backgroundColor = UIColor(named: "AccentColor")
        UITabBar.appearance().standardAppearance  = tabBarAppearance
        UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance

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