代码之家  ›  专栏  ›  技术社区  ›  srikanth rongali

如何使用uitextview在cocos2d中添加滚动文本?

  •  0
  • srikanth rongali  · 技术社区  · 15 年前

    我想要cocos2d中的uitextview。我用init方法编写了代码,

     UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0, windowSize.height/2,windowSize.width/2)];
     textView.backgroundColor = [UIColor clearColor];
     textView.text = @"I am First enemy";
     [textView setEditable:NO]; 
    
     [[[CCDirector sharedDirector]openGLView]addSubview:textView];  
    

    方向是这样的

     [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];   
    

    我需要文本以横向模式出现,但我得到的文本如下。

    alt text http://www.freeimagehosting.net/uploads/b0de877fb2.png

    如何使文本以横向模式显示。我在cocos2d工作。能滚动文本吗?我应该添加什么使文本上下滚动。

    谢谢您。

    1 回复  |  直到 15 年前
        1
  •  0
  •   srikanth rongali    15 年前

    从下面的网址我找到了我的答案

    http://www.cocos2d-iphone.org/forum/topic/3210

    我用过

    textView.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS( 90.0f ));