I have solution for your code, I hope this is what you are looking for.
(我为您的代码提供了解决方案,希望这是您想要的。)
So, first create array of UITextView
just below ht
variable as follow:
(因此,首先在ht
变量下面创建UITextView
数组,如下所示:)
var arrTextFields = [UITextView]()
Then inside didTapAdd
method add subview inside array, so add following line after ht += 50
(然后在didTapAdd
方法内部在数组内添加子视图,因此在ht += 50
之后添加以下行)
arrTextFields.append(subview)
Now inside didTapAdd2
method, write following code
(现在在didTapAdd2
方法中,编写以下代码)
@objc func didTapAdd2() {
self.view.endEditing(true)
cutOff.isSelected = !cutOff.isSelected
arrTextFields.forEach { $0.isScrollEnabled = cutOff.isSelected }
}
I hope this will fix your issue.
(希望这能解决您的问题。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…