721
社区成员
发帖
与我相关
我的任务
分享
- (BOOL)textFieldShouldReturn:(UITextField *)sender
{
if (sender == textField_) {
[sender resignFirstResponder];
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
if (pDelegate != NULL)
{
pDelegate->editBoxReturnButton(getEditBoxImplIOS()->getEditBox());
}
}
return NO;
}
2.文件:UIEditBox.h
// class EditBoxDelegate 下面增加editBoxReturnButton
/**
* This method is called when the return button was pressed or the outside area of keyboard was touched.
* @param editBox The edit box object that generated the event.
* @param returnType One of the EditBox::KeyboardReturnType constants.
*/
virtual void editBoxReturn(EditBox* editBox, int returnType) = 0;
/**
* This method is called when the return button was pressed
* @param editBox The edit box object that generated the event.
*/
virtual void editBoxReturnButton(EditBox* editBox){};
接下来就是自己继承实现