cocos2d-x CCEditBox 字符不能显示完全的bug
(cocos2dx版本 2.2.0)用CCEditBox制作帐号输入框,当输入的内容超过框的宽度时,框里面不会显示当前输入的字符,显示上总有一部分字符被分割
修改方法如下
CCEditBoxImplIOS.mm文件中 ,注掉以下代码
@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方法微调
-(void) setPosition:(CGPoint) pos { CGRect frame = [textField_ frame]; frame.origin = pos; frame.origin.x = pos.x + 5; [textField_ setFrame:frame]; }