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];
    }
  • 相关阅读:
    美国州名来源
    SQL Constraint/Index
    英语中的 姓氏/Surname
    GNU glibc
    英语人名探源/字母升序排列
    About 'atoi'
    封装一个类似jquery的ajax方法
    函数柯里化
    AngularJS实现TodoMVC
    webpack简单使用
  • 原文地址:https://www.cnblogs.com/VindyLeong/p/4201674.html
Copyright © 2011-2022 走看看