2

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

James Z
  • 12,209
  • 10
  • 24
  • 44
sudheer
  • 418
  • 6
  • 20

2 Answers2

0

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.

Sivajee Battina
  • 4,124
  • 2
  • 22
  • 45
  • Sivajee Battina, Thanks for the reply. I understand the behavior of IQKeyboardManager. But the issue here is the view not moving down completely. It hanging like shown in the second screenshot. – sudheer Apr 30 '18 at 12:11
  • My View life cycle is : ViewController(screenshot) -> added a child ViewController . In Child VC has text view. Now while typing ViewController(screenshot) moving up. when i dismiss , it like as second screen shot – sudheer Apr 30 '18 at 12:15
  • Hey, I know that I'm kinda late, but I've run into a similar issue and I think this happens when you use view.safeAreaLayoutGuide, did you use that? – Abdullah Ajmal Jul 09 '19 at 02:15
  • @sudheer, have you solved this issue – iOS Developer Sep 24 '21 at 17:42
0

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

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
Mayank Verma
  • 108
  • 1
  • 8
  • Please answer with something you yourself consider an answer. Or do not answer if you think that what you are is a comment. You seem to have understood https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead So in that siutation pleae do not decide to misuse anohter mechanism (an answer post) for something it is not meant for and you are not yet allowed to do. This however IS an answer as it names an assertive solution. Though in turn .... – Yunnosch Dec 18 '20 at 11:15
  • While this proposal may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch Dec 18 '20 at 11:16