CATextViewDelegate

2018-08-29 16:14 更新

類說(shuō)明

textView事件代理


CATextViewDelegate 方法(點(diǎn)擊查看方法介紹)

方法說(shuō)明
textViewShouldBeginEditing開始編輯時(shí)觸發(fā)
textViewShouldEndEditing結(jié)束編輯時(shí)觸發(fā)
textViewShouldReturn返回時(shí)觸發(fā)
keyBoardHeight鍵盤高度
textViewShouldChangeCharacters文字更改后觸發(fā)


CATextViewDelegate 方法說(shuō)明

virtual bool textViewShouldBeginEditing(CATextView * sender)

返回值:bool

參數(shù):

類型參數(shù)名說(shuō)明
CATextView*sender當(dāng)前textField

解釋:開始編輯時(shí)觸發(fā)


virtual bool textViewShouldEndEditing(CATextView * sender)

返回值:bool

參數(shù):

類型參數(shù)名說(shuō)明
CATextView*sender當(dāng)前textField

解釋:結(jié)束編輯時(shí)觸發(fā)(如果發(fā)件人不想從時(shí)間中分離,返回true)


virtual void textViewShouldReturn(CATextView *sender){}

返回值:void

參數(shù):

類型參數(shù)名說(shuō)明
CATextView*sender當(dāng)前textField

解釋:返回時(shí)觸發(fā)


virtual void keyBoardHeight(CATextView *sender, int height){}

返回值:void

參數(shù):

類型參數(shù)名說(shuō)明
CATextView*sender當(dāng)前textField
intheight高度

解釋:鍵盤高度


virtual bool textViewShouldChangeCharacters(CATextView* sender, unsigned int location, unsigned int lenght, const std::string& changedText);

返回值:bool

參數(shù):

類型參數(shù)名說(shuō)明
CATextView*sender當(dāng)前textField
unsigned int location光標(biāo)選中的字符串,即被替換的字符串
unsigned intlenghtlength為0時(shí),表示刪除
const std::string&changedText更改文本時(shí)Text內(nèi)容

解釋:TextView文字更改后觸發(fā)(返回true表示修改生效,返回false表示不做修改,textField的內(nèi)容不變)

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)