sudheer
sudheer

Reputation: 428

IQKeyboardManager issue , UIViewController top overlapping status bar

I am using IQKeyboardManager.

I am showing an UITextView in middle of the screen with transparent background when I click 'reply'. The entire viewController moving up, fine. but when I dismissed, the viewController top is under the statusBar.

why is it happening?

First Image

Second Image

Upvotes: 2

Views: 1925

Answers (3)

Kegham K.
Kegham K.

Reputation: 1614

I had the same issue for sometime when IQkeyboard was pushed. I solved it simply by adding this to viewWillAppear

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    let appearance = UINavigationBarAppearance()
    appearance.backgroundColor = .white
    self.navigationController?.navigationBar.scrollEdgeAppearance = appearance
    
}

Upvotes: 0

Mayank Verma
Mayank Verma

Reputation: 128

Try moving those TextFields inside a ScrollView and Navigation Bar (if using custom) out of ScrollView. It will solve this issue.

Upvotes: 0

Sivajee Battina
Sivajee Battina

Reputation: 4174

That is the behavior of IQKeyboardManager. IQKeyboardManager will take topmost view controller and based on the textView position it will push the whole view controller to up. There is nothing wrong with the library. That is how it's got implemented. So there are few ways to avoid this.

One way to use below line. Try once. I'm not sure this will work for every project.

self.view.window.windowLevel = UIWindowLevelStatusBar;

Another way is to add one more super view for TextView and try. These are few possible ways of handling it.

Upvotes: 0

Related Questions