Embedded TabBarController hit detection bug? - ios

I may have run into a bug, or perhaps I'm just trying to do things in a way that Apple doesn't want me to.
I've created a GitHub repo with a single sample project which mirrors the UI layout of my app, but with different content, that shows the issue. The app should be run in the simulator with iPad Air selected. It is strictly a landscape oriented app.
In this sample project, I haven't written a single line of code. I've replicated the issue using just storyboard. Because of this, I'm thinking the bug is in iOS or it's just not supposed to be done this way.
In the project, I have the starting UIViewController embedded in a UINavigationController. In the view controller, I have some designated space at the top, which has a simple UILabel in this sample project, and then a container view below it taking up the rest of the space.
Embedded in the container view is a UITabBarController. The tab bar controller links to 2 UITableViewControllers that have static content in them for simplicity.
The issue now is with the hit detection area of the UITabBarItems of the UITabBar of the tab bar controller. You can tap just above the actual tab bar item (below the red line, but above the tab bar section in the image below), which is not supposed to be part of the tab bar, and it will switch to the other table view controller.
In my real project this is an issue because the cells in the table are interactive, and when the user tries to tap on the bottom cell and they are clearly tapping on the cell and not the tab bar, the tab bar is "stealing" the touch and switching tabs instead.
There's about 10 points of vertical space that the tab bar is "stealing" the touch input. I've verified this in my real app by making UITapGestureRecognizers for the table and the UITabBar, with the parent view controller as the delegate and printing out the touch point y value when the delegate is informed of a tap in gestureRecognizer(:shouldReceiveTouch) and in gestureRecognizerShouldBegin().
In my particular sizing, the table receives the tap up to point 710. One point below that, which should be 711, reports as being captured by the UITabBar, but the y value isn't 711, it's 720. That continues all the way to 720, which is where the actual UITabBar area begins. At point 721, it's correctly reported by the gesture recognizer on the UITabBar as being at y value 721. So that entire space between point 711 and 720 is dead space. It's supposed to be detected by the table but it's detected by the UITabBar instead. But what really makes it "dead" space is that all the points between 711 and 720 all report as point 720, so I can't just special case the touch points between 711 and 720 to map to my table.
Is this a known thing? My theory is that it happens because the tab bar controller is embedded in a container view that isn't the full size of the screen, and I don't know if having the whole thing embedded in a navigation controller has any impact or not.

Related

Gray bar visible on iPhoneXS throughout app

Header image with gray bar on top
I am converting our app to fit correctly on newer iOS devices. We are using xib files for the UI. I added a launch screen storyboard to start off the new formatting. I noticed a gray bar across the top of every screen. It is not part of the view controller and I've tried removing the status bar but that only makes the text and icons disappear. I don't think it's the navigation bar either since we have that hidden as well. I have checked the Safe Area Layouts.
Any ideas on what this is and how I can remove it to extend my view all the way to the top? The blue in the image is the color I currently set the background of my view controller and we have a custom header view below that.
Using the View Hierarchy, as suggested, I was able to see the view behind my main view. I inspected the code for that initial view and found the previous developers had offset the Navigation Controller by 20. That is what created the bar on all the views. I have adjusted to remove the offset and it looks perfect now.

UIPageViewController of NavigationController->ViewController's starts 20 pixels too high on load, then moves down

So I've searched and searched and searched for answers regarding this question, and I still cannot figure it out. I've done all of the typical "edgesforextendedlayout", disabling auto adjust scroll views on everything/nothing, unchecking "under top/bottom/opaque bars" and nothing works. I've narrowed it down to pretty much the iPhone 6/6S Plus. Doesn't happen on the iPhone 4S/5/6/6S and an assortment of iPads.
So I have a PageView (that is also one of the tabs on my tab bar controller) of 4 Navigation Controllers and their respective ViewControllers. Inside of the ViewControllers are graphs (iOSCharts). When I click on the "Graphs" tab on my tab bar controller, it goes to the PageView and displays the first graph, and it display fine. Then, only like 75% of the time, and on random graphs, it will start the view all the way at the top (under the status bar), and then a second later drop it down 20 pixels (basically a status bar's height) and display correctly. And after this, no matter where you go in the app/click/change etc, its fine. Its only on the first load.
I linked a picture as well (in the middle of switching pages).
http://i.imgur.com/TcS8l9o.png

UIButtons initially non-functional when positioned on the right-hand side of a view

All:
I am working on an app in which I have multiple UIButtons and UITextFields on the top and right hand side of a UIView. The UIViewController is embedded in a tab bar controller, and I'm using iOS 7.
When the view first appears, the UIButtons and UITextFields on the right are unresponsive -- they are enabled (according to .isEnabled), but the buttons don't flash, and the keyboard doesn't appear when I tap on the UITextField. If I switch to another tab and then back, they work.
The controls at the top work as expected.
However, if I drag the right hand side controls more towards the center of the app, they work first time. There's like a 100 pixel "dead zone" that only goes away when I switch tabs.
Update: If I bypass the tab bar controller completely, and make the view controller associated with the above the initial view controller, then the controls work as they should.
What is going on??
Thanks,
Michael

Any quick solution to make a view appear behind the status bar in iOS 7?

I'm porting my app from iOS 6 to IOS 7 (there will eventually be a complete GUI redesign for iOS 7 but in the meanwhile just getting the existing GUI to display properly on iOS 7 is the goal.
I had the issue where the status bar was overlapping my GUI and so have shifted the Y origin of the view controller's view down by 20.
However my app contains a pulldown which when retracted is overlapping with the status bar. In the screenshot the red is a button which is present in the pulldown view. The grey bar is the top of the main view behind which a portion of pulldown is hiding when retracted.
I implemented the pull down as a fixed size child subview of the main view and when retracted its Y origin is a negative number thus it is effectively still displayed but off the top of the screen. When the user pulls it down I just animate the increase in the Y origin until eventually the origin is 0.
Is there some way I can make the pull down view appear beneath the status bar or some other quick solution?
Note of course I can't simply toggle the pulldown's alpha to display/hide it as it pullsdown obviously thus its appearance/disappearance is not a discreen action. I could maybe attempt to make the portion of it that is on top of the status bar invisible but as its something that is moving that seems like its going to be complicated. Is there any simple solution?
Thanks
Add another view, with a fixed position, under the status bar (with the same color of your grey bar), 20px tall and same width of the status bar, but with a z-index higher than the retracting view. This view will cover the retracting view (but not the status bar) acting as a "background" for the status bar itself. Obviously you have to adjust the Y position of the retracting view to make it tappable by the user (but under the status bar)
iOS 7 by default lets views take up the fullscreen, including the status bar. This is controlled using the UIRectEdgeAll property.
If you want the old style view, set UIRectEdgeNone for self.edgesForExtendedLayout
in viewDidLoad:
self.edgesForExtendedLayout = UIRectEdgeNone;

UIScroll View on IOS 7 lingo

okay, my app was built on for iOS 6 until iOS 7 got released and i started making changes to support both versions. Now, i'm having problems with UScrollView and it's constraints on storyboard. when i add a scroll view to my view which has a navigation bar and add a button (or any subview) for say 20 points under the navigation bar, at runtime the subview get's misplaced vertically. it moves downwards in like 60 points. i guess the same size as the navi bar and the status bar combined. So, i was pulling my hair to know how to fix it with constraints and auto layout but i couldn't figure out how. the app sometimes crashes with a certain mix of layouts. However, what i did was to pull the scroll view aside and place the subviews as i want them to look like with navi bar there, then i pulled it back in it's right place (covering the entire view) and when i run the app it all works as expected. now the question what constraints should i add so that it works as expected without doing the whole process aside and then adding it? right now my view looks like this:
As you can see the button is under the navi bar. but when i runt he app it gets under the bar as i want it to. so how can i just add it on story board under the bar and let it stay there? in iOS 6 i used to do it that way without worrying and ios 7 seems like doing this hard on us.

Resources