0

I have a UIScrollView and contextView. I add UITextViews to it and set the delegate to self so that I can use the textViewShouldBeginEditing method. The textViewShouldBeginEditing is inside the same ViewController.m file, so the VC should be the delegate.

The textViewShouldBeginEditing method gets called and I want to check if the keyboard is blocking the textView and scroll it up if it's being blocked.

I want to call: [scrollView setContentOffset:CGPointMake(x, y) animated:YES]; However scrollView is not seen in textViewShouldBeginEditing.

I've seen where KVO can be used, but I want to use the delegate methods.

How can I gain access to the scrollView that the textView is on?

KarlJay
  • 79
  • 1
  • 9

1 Answers1

1

You can use IQKeyboardManager. Just drag and drop library to your project and eveerything will managage itself. here is the github link for that. IQKeyboardManager. Hope this will help you.

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
  • Thanks, that looks interesting, I downloaded it and will try it out. I'm still wanting to learn how to message from a delegate to another VC. It's not just about this keyboard issue, there's something about ObjC messaging I'm missing. – KarlJay Apr 13 '16 at 18:26