我在cocos2d的CCLayer中有一个UITextView *textView。文本在水平和垂直方向上滚动。但是,我需要它仅垂直滚动和弹跳。
如何以编程方式停止水平滚动?
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 ));
我应该怎么做才能停止水平滚动?
谢谢。
我不知道这是否是一个好的解决方案。但这对我有用。我在这里发帖,以便任何人都可以纠正它。
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];
这对我有用。它仅上下滚动,也上下弹跳。
谢谢。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)