i_m*_*ush 0 iphone objective-c horizontal-scrolling uitextview ios
我正在寻找一种以编程方式禁用UITextView水平滚动的方法,通过Interface Builder很容易,但由于我以编程方式设计视图我无法找到方法来实现这一点,我将其用Google搜索为好吧,但我得到的最多是这个:
它不起作用.任何提示?
self.textViewOpenedRect = CGRectMake(20, 20, 280, 130);
self.textView = [[UITextView alloc] initWithFrame: self.textViewOpenedRect];
self.textView.contentInset = UIEdgeInsetsMake(5, 5, 5, 5);
self.textView.delegate = self;
self.textView.backgroundColor = [UIColor clearColor];
self.textView.contentSize = CGSizeMake( self.textView.frame.size.height, self.textView.contentSize.height);
self.textView.alwaysBounceHorizontal = NO;
self.textView.bounces = NO;
Run Code Online (Sandbox Code Playgroud)
更新:显然问题是因为这行代码:
self.textView.contentInset = UIEdgeInsetsMake(5, 5, 5, 5);
Run Code Online (Sandbox Code Playgroud)
我用它在框架和文本之间有一点空间...am我做得好吗?
Mic*_*lum 12
这应该有助于...
UITextView是一个子类UIScrollView,所以这很容易实现.
mytextView.contentSize = CGSizeMake(mytextView.frame.size.height,mytextView.contentSize.height);
mytextView.showsHorizontalScrollIndicator = NO;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8560 次 |
| 最近记录: |