我创建了一个用于检查的演示UITextView scrollEnabled.它只包含1 UITextView和2按钮启用和禁用滚动
我在模拟器和设备iOS 8上测试,如果我单击禁用滚动按钮,UITextView将禁用正确滚动,但之后我点击启用滚动,UITextView 将不会启用滚动
但是,我在设备iOS9上测试,启用和禁用滚动工作正常.
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextView *myTextView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)enableScrollButtonPressed:(id)sender{
self.myTextView.scrollEnabled = YES;
}
- (IBAction)disableScrollButtonPressed:(id)sender{
self.myTextView.scrollEnabled = NO;
}
@end
Run Code Online (Sandbox Code Playgroud)有什么想法解决这个问题吗?如果有人不理解我的解释请检查
我的演示项目
任何帮助或建议将非常感谢
我UITextView在我的swift应用程序中从头开始编写.我把它textView放在view这样的:
它就在键盘的正上方.
将textView具有附接到约束view:leading,bottom,top和trailing,所有等于= 4.
将view具有以下限制:
trailing,leading,bottom,top和height
Height是我代码中的一个出口.我正在检查有多少行,textView并根据我正在修改的行height:
func textViewDidChange(textView: UITextView) { //Handle the text changes here
switch(textView.numberOfLines()) {
case 1:
heightConstraint.constant = 38
break
case 2:
heightConstraint.constant = 50
break
case 3:
heightConstraint.constant = 70
break
case 4:
heightConstraint.constant = 90
break
default:
heightConstraint.constant …Run Code Online (Sandbox Code Playgroud)