I have a standard UI Tab Bar controller, with the tabs all added using interface builder. I've used the image inset properties to make the large centre button sit on the edge of the tab bar. However, when I tap on the half that's outside the tab bar bounds it doesn't register anything.
I've currently got no code in place for the tab bar, but I'd like to know how I can have a button like this and make it's taps register even when it's outside the tab bar bounds.
Related
I am creating a UI from a mockup that looks like this.
You can see the bottom bar is over the navigation view but not over the sidebar. I want to make the bottom bar outside the navigation view so it does not create a new instance for every view.
Is there any way to do this while supporting macos v11.
I have a UIView that I can drag around the screen via UIPanGestureRecognizer. However, when I drag it down to the bottom of the screen, the view automatically starts to squish vertically when it touches the tab bar. If I keep dragging downward, it will eventually be allowed to drag under the tab bar.
I don't want it to interact with the tab bar at all though. It should just slide under it as if it weren't there. The view controller has Extend Edges Under Top Bars and Extend Edges Under Bottom Bars checked.
Why is the view interacting with the tab bar in the first place? And how do I prevent this behavior?
Finally fixed this by unchecking the "Extend Edges Under Bottom Bars" option on the view controller. The view now slides unimpeded under the tab bar.
i have a view controllers in a tab bar controller with constraints to bottom safe area, but one of them i must hide tab bar i use this
self.tabBarController?.tabBar.isHidden = true
this increase the safe area
But if i need to move to another i show back tab bar
self.tabBarController?.tabBar.isHidden = false
But safe area don't decrease by itself, making view contents behind tab bar
To make it clear i put a red view pinned to bottom safe area, next i go to view and hide tab bar
this is when it come back to this view and show tab bar again, safe area increased below tab bar, that's why red square are more below
It appears to be a bug in iOS. SafeArea doesn't change to account for tabBar, after hiding / showing it.
You can work around it by anchoring your view to superview and adjusting for tabBar manually. For example, if you want to anchor a tableView to a tabBar it would look like this
if let tabBar = tabBarController?.tabBar {
tabBar.isHidden = true
tableViewBottomConstraint.constant = tabBar.frame.height
}
I need to be able to have a scrollable view that contains Tab Bar and two views. The Tab Bar is only supposed to show on the first view; when you swipe right to get to the second view, the tab bar shouldn't be there. (Its supposed to work exactly like Instagram's stories where you can slide to get to the camera on the home screen). Right now I have the scrollable container view embedded in the tab bar controller and I added the two views to the container view within its class. However the Tab Bar is on the bottom of both views.
container view embedded in tab bar controller
code for container view
Does anyone have a solution to fix This?
The reason I want this second bar is because I want it to stay in the totality of my project. I want to have this bar under my navigationbar and stay constant throughout the run of my project.
The top red bar is the nav bar, and the top green bar is my bar. They will have different background colors. The orange/gray box represent the screens that will appear under these bars.
What is the best way to do this?
If it were me, I'd create a view controller called something like MyToolbarViewController and add its view as a child of your navigation controller. Use Auto Layout to give it a constant height, leading, trailing and top layout guide constraints. This will allow this view to remain in place while the navigation controller performs its normal transitions in which navigation bars are replaced with that slide/fade animation. To adjust the content in each view controller pushed onto the navigation controller, adjust insets or top layout guide constraints.