adding a UIScrollView as a superview of 2 UITextview
Posted
by
Risma
on Stack Overflow
See other posts from Stack Overflow
or by Risma
Published on 2010-12-27T03:46:57Z
Indexed on
2010/12/27
3:54 UTC
Read the original article
Hit count: 193
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 when i tap on the 2nd textview, the keyboard is not appear. What i have to do? thx for the advices
© Stack Overflow or respective owner