Swift 2.3 to Swift 3.1 Migration - EZSwipeViewController beneath StatusBar

73 Views Asked by At

I am in process of migrating my Swift2.3 project to Swift3.1. As a part of it, I am facing trouble with a swipe controller that I used - 'ezswipeviewcontroller'.

I am using Xcode8.3, and testing on iOS10.3.2 device/simulator.

Before conversion, the ViewController (with navigatioBar) was properly displayed under the status bar but after conversion the ViewController (with navigatioBar) goes beneath the status bar.

I looked at the SO solutions and understood that the below will work, which DID NOT work in my case :-|

edgesForExtendedLayout = []    
extendedLayoutIncludesOpaqueBars = false    
automaticallyAdjustsScrollViewInsets = false

Here below are the screenshots for reference -

Before Conversion Screenshot After Conversion Screenshot

2

There are 2 best solutions below

1
Lohith Korupolu On BEST ANSWER

I resolved this issue by setting the height of the navigationBar of EZSwipeViewController from 44 to 64.

public static let navigationBarHeight: CGFloat = 64

And everything is perfect now! :-)

5
kevin On

Give your view a layout top constraint to its superview (either in storyboard or with code), let it be relative to margins. It will now start under the status bar. You might have to add leading, trailing and bottom constraints too, to avoid upsetting autolayout.