
上圖,我點擊“發送”按鈕和點擊其他地方都是呼叫下面兩個函式。
editBoxEditingDidEnd();
editBoxReturn();
有沒有什么區別,是我點擊“發送”按鈕的
cocos 3.6 xcode 下 ios
uj5u.com熱心網友回復:
自己搞定了。修改兩個地方。 標記下1.檔案:UIEditBoxImpl-ios.mm
- (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){};
接下來就是自己繼承實作
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/50507.html
標籤:Cocos2d-x
上一篇:影片只包含圖片切換,但是運行時,總是先移動到擺放位置,再播放切換圖片影片
下一篇:菜鳥求助
