Preventing UINavigationController transitions animating upwards with an offset in iOS 11? - ios

I'm updating an app from iOS 10 to iOS 11 with an iOS 9 target and this happens on every segue animation when a navigation bar is involved.
The animation starts with a small offset lower than the height it should be at and then moves to the proper height by the time the view has finished animating.
I'm not doing anything special to the navigation controllers, and it happens to each one in the app. If I programatically hide the navigation bar, the transitions animate normally.

Setting the tableView.contentInsetAdjustmentBehavior to .never in a UINavigationController fixes the problem.
Edit: Actually a better solution is to activate the Under Opaque Bars option for the TableViewController instead.
Otherwise the vertical scroll bars will be behind the iPhone X notch in landscape mode. This worked for me, because I use opaque bars. I don't know what happens if you use translucent bars.
The original solution is described by Prince on the Apple Developer Forums:
After some research ...I found that automaticallyAdjustsScrollViewInsets is deprecated in iOS 11, Now we are to use contentInsetAdjustmentBehavior in UIScrollView type views instead. Setting contentInsetAdjustmentBehavior to .never worked and also the 'UINavigationController translation slide up issue' wouldn't happen if the UINavigationBar is transulcent where the view is under the bar. (Thus the new way of doing the automaticallyAdjustsScrollViewInsets`)
This is not good for Storyboard users because this will have to be done in code.

The top/bottom layout guides were deprecated in iOS11 and I think your issue is connected to this. So you can change the constraints I think.
Read more here.

Related

IOS 11 navigation bar appears smaller than it should

I have a custom navigation bar that worked well until iOS 11. It appears smaller than it should and seems to ignore the status bar height or something.
I set the whole thing programmatically and the height is set to 64.
have you tried to disable (untick) safe area?

Status bar overlaps on my view

I have a UIViewController subclass which when I run the app on iOS 7, the status bar shows on top of my view. Is there a way to avoid this? I do not want the status bar to be hidden. Is there a way to show the status bar above my app. I present my view using presentViewController. Please guide what I am missing?
In Xcode, In storyboard there is an option of iOS6/7 delta. set delta Y to 20 pixel of your view, to make compatible with iOS7.For this you have to disable auto layout, you can use auto resizing.
This is quite common issue. Starting from iOS 7 Status Bar is a part of the controller's view. Apple even have added special attribute of UIView in the Interface Builder: iOS 6/7 Deltas. To fix your problem and make your view look the same in different iOS versions, go to Size inspector and set Delta Y to 20.0.

iOS 6/7 Delta's not working iOS 7.1

My app is in the app store, was working fine with deltas set for ios7. With the recent 7.1 update, these deltas seem to magically have stopped working.
Anyone know more about this issue? Googling provided no relevant links. This HAS to have happened to someone else.
This problem was eating my lunch, too. In my particular case, it was an easy fix.
For me, the crux of the problem was my ignorance of the implications of a translucent navigation bars I didn't even need to use the iOS 6/7 deltas the way I was using them.
With a translucent navigation bar, the coordinate (0,0) of the parent view is the top left corner of the navigation bar. However, when the navigation bar is opaque, the parent view's coordinate (0,0) is just below the navigation bar on the far left. I was using iOS 6/7 deltas to compensate for the different navigation bar heights between the two platform versions. I was trying to use translucent navigation bars like opaque navigation bars and I didn't realize it.
My solution was to change all of my navigation bars to opaque and move the views to autolayout. This allowed my views & controls to be positioned relative to the "top" of the parent view with "top" being what I was expecting: the border of the navigation bar.
Hopefully this helps.

iOS 6/7 20px difference using autolayout

I've got a background for the project that I am working on, which includes a 20px coloured bar for the top of an iOS 7 device.
This worked fine without autolayout, setting a 20px delta in storyboard. But now I can't do that, and I am stuck with constraints - which I cannot set on a per-OS basis.
Whatever I do, I seem to end up with the version on iOS 7 being 20px higher than on ios 6... Something I need to rectify, as I also have a bar under that status bar which is coloured for a navigation controller.
I've attached the background image - if I need to modify it to work with autolayout, I'm happy to do that.
There is a "top layout guide" object in your view hierarchy. If you build vertical constraints based on that, they pin to the top of the window if there is no status bar, or under the status bar otherwise. Use that.

UISplitView with UITabbar

I have a strange one that I can not seem to fix. I am currently working on updating my app to iOS7. This all worked in iOS6. It is an universal app and thus uses same xib files. However the iPad uses UISplitViews on some. Like I said, this all worked in iOS6 oh this all works on the iPhone too.
The problem is a grey bar at the bottom. I changed the tab bar to be opaque to move views up properly as i had some UI clipped to bottom of views and that went underneath the tab bar, sidetracked there. But if i set it back to translucent bar, it goes underneath but stretched properly. if i dont, it adds a bar. Other tabs work fine when NOT using splitview.
The UISplitviewController is added programmatically.
See attached image for better description.
This I have tried:
Added autoresize on splitview
Checked xib for subviews in the splitviews to have auto resize
Tried to force splitview to be screen bounds
Removed clips to bounds on all views
Removed autoresize subviews
Any ideas would be welcomed.
Thank you all.
UPDATE:
setting the background colour the uisplitview, it does colour the bar black. So the uisplitview is definitely stretching to it.
I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.
self.extendedLayoutIncludesOpaqueBars = YES;
I believe I have found an alternative solution for you. I have had the exact same problem, mostly because we are both doing something against Apple's Guidelines which is having a SplitViewController nested within a Tabbar controller (SplitView should be the root view). This was okay in iOS 5/6, but now in iOS 7 there are far too many side effects to achieve this.
The reason you see your view stretch completely when you set the bar to be translucent is because the bar is NOT taken into account when drawing the view. When you set translucent to false, it is then taken into account of the view and you will see that grey bar there because that's your view pretending there's a tabbar at the bottom of the screen.
And as always, a SplitViewcontroller's height cannot be changed, as it is determined by the visible window height.
I tried everything you did and then some. The real solution came from using a third-party Split View Controller.
I recommend switching over to https://github.com/mattgemmell/MGSplitViewController . This split view controller is actually one large View with container views living inside of it. Because of this, you avoid all the side effects of putting an actual split view controller within a tab bar.
If that doesn't float your boat, you could create your own solution which follows the same idea of having one UIViewController with two container views contained in it, though the people behind MGSplitViewController did a good job of that already.
This was the only way I was able to solve this issue, let me know if you find an alternative.
Instead of creating a subclass for UISplitViewController, I just added this code on my master's viewDidLoad:
self.splitViewController?.extendedLayoutIncludesOpaqueBars = true
For the controller that is the detail view of UISplitViewController you just do this:
-(UITabBarController*)tabBarController{
return nil;
}

Resources