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

发布于 2024-08-31 04:59:54 字数 787 浏览 1 评论 0原文

我想要一个 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];   

我需要文本以横向模式显示,但我以以下方式获取文本。

替代文本 http://www.freeimagehosting.net/uploads/b0de877fb2.png

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

谢谢。

I want a UITextView in cocos2d. I used in init method I wrote the code ,

 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];  

the orientation is in this way

 [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];   

I need the text to appear in landscape mode, but I am getting the text in following way.

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

How can I make the text to appear in the landScape mode. I am working in cocos2d. CanOI scroll the text ? What should i add to make the text scroll up and down.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴情换悲伤 2024-09-07 04:59:54

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

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

我用过

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

from the below url I found my answer

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

I used

textView.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS( 90.0f ));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文