How to programmatically stop horizontal scrolling?

I have a UITextView * textView in cocos2d CCLayer. The text scrolls horizontally and vertically. But I need it to scroll and bounce only vertically. How to programmatically stop horizontal scrolling?

UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(100,200, windowSize.height/2,windowSize.width/2)]; textView.backgroundColor = [UIColor clearColor]; textView.text = @"I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy"; [textView setEditable:NO]; textView.font = [UIFont fontWithName:@"Helvetica" size:24.0f]; CGPoint location = CGPointMake(200, 160); textView.showsHorizontalScrollIndicator = NO; //textView.bounces = NO; //textView.alwaysBounceVertical = YES; textView.center = location; textView.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS( 90.0f )); 

What needs to be done to stop horizontal scrolling?

Thanks.

+2
source share
1 answer

I do not know if this was a good decision. But it worked for me. I am posting here so that someone can fix it.

  textView = [[UITextView alloc] initWithFrame:CGRectMake(100,200,200 ,200)]; textView.backgroundColor = [UIColor clearColor]; NSLog(@"description: %@", enemyDescription); textView.text = enemyDescription; [textView setEditable:NO]; textView.font = [UIFont fontWithName:@"Helvetica" size:14.0f]; CGPoint location = CGPointMake(200, 160); textView.showsHorizontalScrollIndicator = NO; textView.alwaysBounceVertical = YES; textView.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS( 90.0f )); [[[CCDirector sharedDirector]openGLView]addSubview:textView]; 

It worked for me. It scrolls only up and down, and also bounces up and down.

Thanks.

+1
source

All Articles