以下代码段显示在屏幕上正确的背景顶部,但是文本不会滚动。
我想念什么?
-(void) viewWillAppear:(BOOL)animated {
UITextView *scrollableText = [[UITextView alloc] initWithFrame:CGRectMake(20, 20, 300, 800)];
[scrollableText setOpaque:TRUE];
[scrollableText setBackgroundColor:[UIColor clearColor]];
[scrollableText setEditable:NO];
[scrollableText setText:@"some really really long text"];
[scrollableText setScrollEnabled:YES];
UIImage *backgroundImage = [[UIImage alloc] initWithCGImage:[UIImage imageNamed:@"about_bg.png"].CGImage];
UIImageView *backgroundView = [[UIImageView alloc] initWithImage:backgroundImage];
[backgroundView addSubview:scrollableText];
[[self view] addSubview:backgroundView];
}
最佳答案
除了[textview setUserInteractionEnabled:YES]
之外,还可以尝试textView.userInteractionEnabled = YES;
或setScrollEnabled
。
关于ios - UITextView不滚动,需要帮助,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8206116/