【发布时间】:2016-08-04 23:45:35
【问题描述】:
我有一个 UIScrollView 和 contextView。我将 UITextViews 添加到它并将委托设置为 self 以便我可以使用 textViewShouldBeginEditing 方法。 textViewShouldBeginEditing 位于同一个 ViewController.m 文件中,因此 VC 应该是委托。
textViewShouldBeginEditing 方法被调用,我想检查键盘是否阻塞了 textView,如果它被阻塞则向上滚动。
我想打电话: [scrollView setContentOffset:CGPointMake(x, y) 动画:YES]; 但是在 textViewShouldBeginEditing 中看不到 scrollView。
我已经看到可以在哪里使用 KVO,但我想使用委托方法。
如何访问 textView 所在的 scrollView?
【问题讨论】:
标签: objective-c uiscrollview keyboard uitextviewdelegate