Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift UITextView分页不滚动_Swift_Uiscrollview_Uitextview_Paging - Fatal编程技术网

Swift UITextView分页不滚动

Swift UITextView分页不滚动,swift,uiscrollview,uitextview,paging,Swift,Uiscrollview,Uitextview,Paging,之前有人问了一个完全相同的问题,但我希望有人将答案的代码转换为Swift,因为它在objective-c中。我也想在故事板中完成大部分工作,那么用户能帮我吗? 如果你懒得看链接,就像我们一样: CGRect labelFrame; UITextView *textView; labelFrame.size.width = scrollView.frame.size.width-24; labelFrame.size.height = scrollView.frame.size.height-

之前有人问了一个完全相同的问题,但我希望有人将答案的代码转换为Swift,因为它在objective-c中。我也想在故事板中完成大部分工作,那么用户能帮我吗?

如果你懒得看链接,就像我们一样:

CGRect labelFrame;
UITextView *textView;

labelFrame.size.width = scrollView.frame.size.width-24;
labelFrame.size.height = scrollView.frame.size.height-48;
labelFrame.origin.x = 10;
labelFrame.origin.y = 40;

textView = [[UITextView alloc] initWithFrame:labelFrame];
textView.textColor = [UIColor blackColor];
textView.backgroundColor = [UIColor redColor];
textView.font = [UIFont systemFontOfSize:13];
textView.text = @"a very long text";

textView.editable = NO;
textView.scrollEnabled = YES;
textView.userInteractionEnabled = YES;
textView.delegate = self;
textView.contentSize = CGSizeMake(1, 1000); //this would make it scroll?
[subview addSubview:textView];

还有,问题的答案我不完全明白他在说什么

我不确定是否完全理解您的问题,但如果您想从情节提要启用UITexView中的滚动,请从对象库拖放UITextView,并在属性检查器中为UITextField选择已启用滚动的属性。 删除 textView.scrollEnabled=是; textView.userInteractionEnabled=是; 粘贴

textView.isSelectable = false
textView.isEditable = false