How do I enable UILargeContentViewerInteraction on a UITabBar outside of a UITabBarController? - ios

iOS 13 added the UILargeContentViewerInteraction class for showing a large title and icon when the user long-presses on a tab bar or similar UI that might be custom. It works out of the box with the tab bar in a UITabBarController, and it can be set up easily on custom views by setting the UILargeContentViewerItem-related properties on UIView.
My question is this: how do I enable it on a UITabBar in my app that's not connected to a UITabBarController? There don't appear to be any relevant properties on UITabBarItem.

Related

UITabBar attachment view, conform to hidesBottomBarWhenPushed

How can we attach a view to a UITabBar or UITabBarController and allow it to conform to things like "Hide bottom bar on push"? Any view that gets added to the UITabBarController will a part of the UINavigationController, meaning that the view will not take part in the tab bar animation, and will simply be left visible after a push.
Is it frowned upon to subclass UITabBar itself, and if not, how would we handle the subviews of it? My attachment is located behind the tab bar and becomes visible when needed (like Spotify's or Apple Music's player bar), which causes problems when iOS automatically moves the z-index of the tab bar during these situations.

Tab Bar Icon not appearing after setting custom class - iOS

I set the icon set in the storyboard of the Tab Bar Item. This displays fine when that view controller has no custom classes. But as soon as I link it with my Custom Class, it disappears.
How do I get the tab bar to display the icon set that's been set in storyboard??

make tabbar button as unselected when clicked on the navigation bar button

i am facing the problem with the tab bar,when i clicked on navigation bar button,the tab bar button is should be unselected,i tried but failed to do that.can any one help me to resolve the issue.
If i understood your needs, I guess what you want to do is to select no item at all in your tabbar.
So doing :
[tabBar setSelectedItem:nil];
should be what you need.
That is only if your tabBar is not handled by a UItabBarController. Else you'll get the following exception.
Directly modifying a tab bar managed by a tab bar controller is not allowed.
This behavior is unfortunately logical if you read the doc on the tabBar property of a UItabBarController : UITabBarController documentation - tabBar
You should never attempt to manipulate the UITabBar object itself stored in this property. If you attempt to do so, the tab bar view throws an exception. To configure the items for your tab bar interface, you should instead assign one or more custom view controllers to the viewControllers property. The tab bar collects the needed tab bar items from the view controllers you specify.
And reading through this page you'll see that UITabBarController gives you no means of selecting an item other than the ones on your tabBar (except the moreNavigationController UITabBarController documentation - moreNavigationController )
EDIT : If you do want to keep your tabBar shown, you can trick the users and make them believe the tab is unselected by applying the "unselected style" to the selected tab. This question should give you everything you need to do that : How to change inactive icon/text color on tab bar?

How to change 'More' view controller tintColor of UITabBarController?

I have seven UIViews attached to a navigation Controller - Each has an icon as below -
As there are more than 5 pages linked - the tab bar adds a more icon - which when pressed displays a sub page with the further menu options -
The sub page and the subsequent links have a nav bar - which has a blue tint color which I'd like to change to orange to match the rest of the app. My question is how do I style this as it doesn't appear in the storyboard?
You can access that view controller using the moreNavigationController property of UITabBarController.
As you can read in the documentation:
This property always contains a valid More navigation controller, even if a More button is not displayed on the screen. You can use the value of this property to select the More navigation controller in the tab bar interface or to compare it against the currently selected view controller.
Therefore you can do something like
self.tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor orangeColor];
UIBarButtonItem instances like those in your navigation bar take their tint color from their nearest parent view that has a tint color set. If there isn’t one, they use the default system blue. The iOS 7 UI Transition Guide describes how you can set the tint color for your whole app at once.
The Global Tint menu in the Interface Builder Document section of the File inspector lets you open the Colors window or choose a specific color.
You can use tabBarController.moreNavigationController.view.tintColor = UIColor(color).
Or in subclass of tabBarController just call self.view.tintColor = UIColor(Color) in viewDidLoad and it will affect more screen and edit screen.

How to hide the UITabBar and show UIToolBar?

I read several answers to this question but couldn't figure out how to do it. I'm using Xcode 4.2 with ARC and no storyboards.
I'm developing an app based on the TabBar application template and extended it to contain 4 UITabBars. I'm not using UINavigationController but instead using UINavigationBar next to the status bar. When the app is loaded with the first tab shown, I have a button on the UINavigationBar and when I press it, I want to hide the UITabBar and instead show the UIToolBar at the same location where the UITabBar was located.
I tried to hide and show using the hidden property (hiding the UITabBar and showing UIToolBar). What happens is the UITabBar is hidden but the UIToolBar is shown above the location where the UITabBar was shown before. This looks ugly and I want it to be shown at the very bottom of the screen.
I think I can't use hidesBottomBarWhenPushed as I don't use a UINavigationController but instead using Navigation bar directly.
Also, I want to revert back to showing the UITabBar and hide the UIToolBar when pressing the same button on the UINavigationBar.
I am not sure if my idea would work for your scenario. Here it is...
but before, just let me tell you that hiding UITabBar, unlike hiding UINavigationBar is not animated. So to me, hiding tabBar is not a user-friendly approach, unless you create your own subclass of UITabBarController that animates hiding the UITabBar.
You can use presentModalViewController:animated and dismissModalViewControllerAnimated: methods. The viewController that is being shown modally can have a UINavigationBar, it pops out from the bottom of the screen and covers the UITabBar with animation.
Hope that helps.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

Resources