I have a UITextView , i want show its\' text in horizontal, my UITextView has a static width
[[UITextView alloc] initWithFrame:CGRectMake(0, 0, 161, 23)];
<
put this code after initializing
[txt setContentOffset:CGPointMake(give_high_value_here_than_content, y)];
Good luck
mscrollview.contentSize = CGSizeMake(180,30);
mscrollview.showsHorizontalScrollIndicator = YES;
Use this 2 lines.
- (void)viewDidLoad {
// We restrict the horizontal scrolling here.
self.textView.contentSize = self.textView.frame.size;
}
Implement this text view delegate method.
Now when the characters entered becomes greater than 23, we set the content size of the text view to a higher value so that horizontal scrolling gets enabled automatically.
- (void) textViewDidChange:(UITextView *) tView {
if (tView.text.length > 23) {
// Set some higher width of the text view content size.
tView.contentSize = CGSizeMake(200.0f, tView.frame.size.height);
}
}
If you are using interface builder then just check the property.
show horizontal scrolling.
by default this property is not enable