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
UPDATE
this my code after do some advises like mac gave to me :
- (void)viewDidLoad {
[super viewDidLoad];
scrollTextView.showsVerticalScrollIndicator = YES;
scrollTextView.showsHorizontalScrollIndicator = YES;
scrollTextView.scrollEnabled = YES;
_codeTextView.showsHorizontalScrollIndicator = NO;
_codeTextView.showsVerticalScrollIndicator = NO;
_codeTextView.scrollEnabled = YES;
_codeTextView.tag = 0;
_codeTextView.delegate = self;
lineNumberTextView.showsVerticalScrollIndicator = NO;
lineNumberTextView.showsHorizontalScrollIndicator = NO;
lineNumberTextView.scrollEnabled = YES;
lineNumberTextView.tag = 1;
lineNumberTextView.delegate = self;
}
but just the _codeTextView scroll, the lineTextVew stil didn't scroll...somebody know why??