Disable Horizontal Scrolling to UITextView Programmatically

后端 未结 3 1127
迷失自我
迷失自我 2021-01-16 03:06

I\'m looking for a way to disable horizontal scrolling of a UITextView programmatically, it was easy via the Interface Builder, but since I\'m designing the view programmati

3条回答
  •  暖寄归人
    2021-01-16 03:55

    This should help... UITextView is a subclass of UIScrollView, so this is pretty easy to implement.

    mytextView.contentSize = CGSizeMake(mytextView.frame.size.height,mytextView.contentSize.height);
    
    mytextView.showsHorizontalScrollIndicator = NO;
    

提交回复
热议问题