1

I have scrollview on which multiple text field are there. But when my KeyBoard shown my all text field and label collapse

 func keyboardWillShow(sender: NSNotification) {
            scroll.frame = CGRectMake(scroll.frame.origin.x, scroll.frame.origin.y, scroll.frame.size.width, self.view.frame.size.height - 216)
        }

        func keyboardWillHide(sender: NSNotification) {

            scroll.frame = CGRectMake(scroll.frame.origin.x, scroll.frame.origin.y, scroll.frame.size.width, self.view.frame.size.height)
        }
Eric Aya
  • 68,765
  • 33
  • 165
  • 232
Chaman sharma
  • 41
  • 2
  • 8

1 Answers1

0

self.view.frame.size.height - 216)

Did you notice this part in your this line

 scroll.frame = CGRectMake(scroll.frame.origin.x, scroll.frame.origin.y, scroll.frame.size.width, self.view.frame.size.height - 216)

When you keyboard appears at that time you are changing the height of view. And also don't check in simulator. Run on actual device.

you need to handle it in proper way. for ex : How do I scroll the UIScrollView when the keyboard appears?

Community
  • 1
  • 1
Wolverine
  • 4,226
  • 1
  • 22
  • 45