修改下面两个文件中方法:
1、 UIEditBoxImpl-ios.mm
void EditBoxImplIOS::createNativeControl(const Rect& frame)
{
// auto glview = cocos2d::Director::getInstance()->getOpenGLView();
//
// Rect rect(0, 0, frame.size.width * glview->getScaleX(), frame.size.height * glview->getScaleY());
//
// float factor = cocos2d::Director::getInstance()->getContentScaleFactor();
//
// rect.size.width /= factor;
// rect.size.height /= factor;
//
//
auto director = cocos2d::Director::getInstance();
auto glview = director->getOpenGLView();
CCEAGLView *eaglview = static_cast<CCEAGLView *>(glview->getEAGLView());
float factor = eaglview.contentScaleFactor;
Rect rect(0, 0, frame.size.width / factor, frame.size.height / factor);
_systemControl = [[UIEditBoxImplIOS_objc alloc] initWithFrame:CGRectMake(rect.origin.x,
rect.origin.y,
rect.size.width,
rect.size.height)
editBox:this];
}
2、 CCUIEditBoxIOS.mm
- (void)setContentSize:(CGSize)size
{
CGRect frame = self.textInput.frame;
frame.size = size;
self.textInput.frame = frame;
self.frameRect = CGRectMake(0, 0, size.width, size.height);
}