zoukankan      html  css  js  c++  java
  • cocos2d-x CCEditBox 字符不能显示完全的bug

    cocos2d-x CCEditBox 字符不能显示完全的bug

    (cocos2dx版本 2.2.0)用CCEditBox制作帐号输入框,当输入的内容超过框的宽度时,框里面不会显示当前输入的字符,显示上总有一部分字符被分割

    修改方法如下

    CCEditBoxImplIOS.mm文件中 ,注掉以下代码

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    @implementation CustomUITextField
    //- (CGRect)textRectForBounds:(CGRect)bounds {
    //    float padding = CC_EDIT_BOX_PADDING * cocos2d::CCEGLView::sharedOpenGLView()->getScaleX() / [[EAGLView sharedEGLView] contentScaleFactor ];
    //    CGRect rect =  CGRectMake(bounds.origin.x + padding, bounds.origin.y + padding,
    //                      bounds.size.width - padding*2, bounds.size.height - padding*2);
    //    return rect;
    //}
    //- (CGRect)editingRectForBounds:(CGRect)bounds {
    //    return [self textRectForBounds:bounds];
    //}
    @end

      setpostion方法微调

    1
    2
    3
    4
    5
    6
    7
    -(void) setPosition:(CGPoint) pos
    {
        CGRect frame = [textField_ frame];
        frame.origin = pos;
        frame.origin.x = pos.x + 5;
        [textField_ setFrame:frame];
    }
  • 相关阅读:
    各种贴图
    d3d11devicecontext
    小记2
    Tom Ryaboi
    Tessellation
    关于图形学
    第一章实验
    控制输入框只接收数字及小数点
    JQuery控制文本框是否可以输入
    SQLSERVER中查询一个存储过程使用到的地方
  • 原文地址:https://www.cnblogs.com/VindyLeong/p/4201674.html
Copyright © 2011-2022 走看看