如何仅在UITextView上强制水平滚动

JAH*_*lia 1 iphone xcode uiscrollview uitextview ios

我有一个UITextViewcontentSize属性设置为一个非常大的值1000,的宽度UITextView为200,启用屏幕滚动,水平弹跳启用和垂直弹跳被禁止,但这个UITextView还是垂直滚动大文本.我怎么能强制水平滚动呢?

ps 这里的解决方案不起作用.

ris*_*shi 5

UITextView是 - UIScrollView的子类.因此,您可以使用ScrollViewDelegate方法来禁用它.

使用 -

- (void)scrollViewDidScroll:(id)aScrollView
{
    [aScrollView setContentOffset:CGPointMake([scrollView contentOffset].x, 0.0)];
}
Run Code Online (Sandbox Code Playgroud)