uitabbar

Hide UITabBar in landscape

ぐ巨炮叔叔 提交于 2021-02-08 09:51:40
问题 How does one hide the UITabBar programmatically? It's been asked and answered multiple times on SO, but the answers seem to come in roughly two varieties: 1) Using a navigation controller, one can hide the next vc's tab bar before the push using hidesBottomBarWhenPushed property. Typical answer here. 2) Walk through the tabbar controller's view hierarchy and modify the tab bar's frame and/or visibility. Typical answer here. But both sorts of answers fall short, imo. 1) What if we need to hide

Navigation Bar Blinks When Animating for the First Time

北城余情 提交于 2021-02-07 19:58:50
问题 I have created my own tabbarcontroller of sorts, but am having an issue with animation. When I animate the views on tab click, the navigation bar turns completely black (should be red), then blinks back to red after the animation completes. My setup and code is below. (Answers in either swift or objective-c are helpful since the tranlastion is easy) Thanks in advance! red: Navigation Bar blue: Navigation Display View grey: Tab Bar burgundy: Tab Bar Display View (This is the part being

Change Tabview color based on which tab is selected -Swiftui

夙愿已清 提交于 2021-02-05 07:10:03
问题 I am trying to see if I can make the color of the bottom tabview change depending on which tab item is selected. Currently I can make the tabview bar clear with the below code in the init. let tabBar = UITabBar.appearance() init() { tabBar.barTintColor = UIColor.clear tabBar.backgroundImage = UIImage() tabBar.shadowImage = UIImage() } ... TabView(selection: $selectedTab) { FirstView() .tabItem{ Text("First") } SecondView() .tabItem{ Text("Second") } } .onAppear{ setTabViewBackground() } func

Change Tabview color based on which tab is selected -Swiftui

喜欢而已 提交于 2021-02-05 07:09:39
问题 I am trying to see if I can make the color of the bottom tabview change depending on which tab item is selected. Currently I can make the tabview bar clear with the below code in the init. let tabBar = UITabBar.appearance() init() { tabBar.barTintColor = UIColor.clear tabBar.backgroundImage = UIImage() tabBar.shadowImage = UIImage() } ... TabView(selection: $selectedTab) { FirstView() .tabItem{ Text("First") } SecondView() .tabItem{ Text("Second") } } .onAppear{ setTabViewBackground() } func

image scaling for UITabBar background image

荒凉一梦 提交于 2021-01-27 08:38:11
问题 I've created UITabBarController in my application. Then in viewDidLoad() I want to change UITabBar background image. Here is the code I'm trying to make it works: class MainTabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() UITabBar.appearance().translucent = false UITabBar.appearance().backgroundColor = UIColor.clearColor() UITabBar.appearance().backgroundImage = UIImage(named: "tabbar_background") UITabBar.appearance().contentMode = .ScaleAspectFit } }

How to set top left and right corner radius with desired drop shadow in UITabbar?

可紊 提交于 2020-08-22 12:05:03
问题 I've spent almost a couple of hours to figure it out. However, it did not happen and finally, I had to come here. Two things are required to be achieved : Firstly I'd like to have a spontaneous corner radius at the top (which is basically TopRight & TopLeft) of UITabbar . Secondly, I'd like to have a shadow above those corner radius(shown in below image). Please have a look at below image Let me know if anything further required from my side, I'll surely provide that. Any help will be

How to set top left and right corner radius with desired drop shadow in UITabbar?

无人久伴 提交于 2020-08-22 12:03:32
问题 I've spent almost a couple of hours to figure it out. However, it did not happen and finally, I had to come here. Two things are required to be achieved : Firstly I'd like to have a spontaneous corner radius at the top (which is basically TopRight & TopLeft) of UITabbar . Secondly, I'd like to have a shadow above those corner radius(shown in below image). Please have a look at below image Let me know if anything further required from my side, I'll surely provide that. Any help will be

Change tab bar height and width and add rounded corners

大憨熊 提交于 2020-06-27 03:54:06
问题 I wonder if its possible to change the width and height and add rounded corners to a tab bar? More or less like this: I want to make the tab bar smaller and add rounded corners. I now that I can change the size with something like this: override func viewWillLayoutSubviews() { var tabFrame = self.tabBar.frame // - 40 is editable , the default value is 49 px, below lowers the tabbar and above increases the tab bar size tabFrame.size.height = 40 tabFrame.origin.y = self.view.frame.size.height -

UITabBar background image not showing properly

大憨熊 提交于 2020-06-02 11:14:38
问题 I made custom UITabBar class and tried to set background image. tabBar.backgroundImage = UIImage(named: "my_image")?.imageWithRenderingMode(.AlwaysOriginal) I set the image file name to my_image@2x and image file is 640*98 I run on iPhone6 simulator and it seems the image is not wide enough like Google's "C" is repeated on sample below Im I using wrong image size or is something else is wrong? 回答1: Just redraw the image: var image = UIImage(named: "my_image") if let image = image { var

Select a tab bar item programmatically (not using UITabBarController)

妖精的绣舞 提交于 2020-05-26 10:16:46
问题 I have a view derived from UIViewControler (not UITabBarController). In this view I added a tab bar with several tab bar items. I used the UITabBarDelegate to allow the view to do something when users tap on each tab bar item. class MyViewController: UIViewController, UITabBarDelegate { func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem!) { // do something } } My question is how we can programmatically select the first tab bar item when the view is first loaded? Note that I would