2
我在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的contentView邊界並調整了字體大小,以便它適合textView – kervich 2013-04-02 12:15:51