1

我想在Cocos2d中使用UITextField,所以写了如下代码:

// In HelloWorldLayer...
-(id) init
{
    if( self=[super init] )
    {
        CGSize winSize = [[CCDirector sharedDirector] winSize];
        UIView *view = [[CCDirector sharedDirector] openGLView];

        //        CGRect rect = CGRectMake(60.0, 45.0, 360.0, 25.0);
        CGPoint pos1 = ccp( 60.0, winSize.height - 45.0 );
        CGPoint pos2 = ccp( 360.0, 25.0 );

        pos1 = [[CCDirector sharedDirector] convertToUI:pos1];
        pos2 = [[CCDirector sharedDirector] convertToUI:pos2];

        // UITextField *_tField; it is declared in field
        _tField = [[UITextField alloc] initWithFrame:CGRectMake(pos1.x, pos1.y, pos2.x, pos2.y)];
        _tField.backgroundColor = [UIColor whiteColor];
        _tField.borderStyle     = UITextBorderStyleRoundedRect;
        _tField.returnKeyType   = UIReturnKeyDone;
        _tField.delegate        = self;

        [view addSubview:_tField];
    }
    return self;
}

现在,我有这样的问题: http://serviceapi.nmv.naver.com/flash/convertIframeTag.nhn?vid=F25D1799886DD32FDA54463C2458197E492A&outKey=V1269fde60a3180c7d50216a83d22b478817df9b6060a511adffa16a83d22b478817d&width=720&height=438

我怎么解决这个问题...?

4

1 回答 1

1

通过这个问题,你的意思是为什么文本不是水平书写的?因为文本实际上是横写的,可能你还有其他影响代码的东西。

于 2012-10-05T07:54:21.467 回答