adding a UIScrollView as a superview of 2 UITextview made no view can be scrolled

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 8:54 UTC
Read the original article Hit count: 176

Filed under:
|
|

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 :

alt text

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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiscrollview