adding a UIScrollView as a superview of 2 UITextview made no view can be scrolled
- by Risma
hi
i have 2 textview in a viewcontroller. the 1st textview is not editable, but the 2nd is editable. i want to make both of them scroll in the same position and size when the keyboard is appear. I think i have to use UIScrollView as base of both of textview. And then i add the UIScrollView in xib (bot of textview are made in xib too). and this is the picture if this hierarchy :
in the viewDidLoad method, i add this code :
- (void)viewDidLoad {
[super viewDidLoad];
[scrollTextView addSubview:lineNumberTextView];
[scrollTextView addSubview:_codeTextView];
[lineNumberTextView bringSubviewToFront:scrollTextView];
[_codeTextView bringSubviewToFront:scrollTextView];
}
but after that i can't scroll anything. What i have to do?
thx for the advices