W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
類(lèi)說(shuō)明
CATextField是單行輸入框控件。主要接收用戶(hù)的文本輸入,多用于用戶(hù)名、密碼、聊天輸入等。
CATextField 屬性(點(diǎn)擊查看方法介紹)
屬性 | 說(shuō)明 |
Delegate | 數(shù)據(jù)代理 |
ClearButtonMode | 添加按鈕模式 |
MarginLeft | 左邊緣 |
MarginRight | 右邊緣 |
FontSize | 字體大小 |
PlaceHolderText | PlaceHolder文本內(nèi)容 |
PlaceHolderColor | PlaceHolder文本內(nèi)容顏色 |
Text | 文本內(nèi)容 |
TextColor | 文本內(nèi)容顏色 |
KeyboardType | 鍵盤(pán)類(lèi)型 |
ReturnType | Return鍵類(lèi)型 |
TextFieldAlign | TextField的對(duì)齊方式 |
SecureTextEntry | 設(shè)置TextField為密碼輸入框 |
AllowkeyBoardHide | 返回鍵恢復(fù)鍵盤(pán) |
MaxLenght | 最大長(zhǎng)度 |
CATextField 方法(點(diǎn)擊查看方法介紹)
方法 | 說(shuō)明 |
resignFirstResponder | 隱藏鍵盤(pán)第一響應(yīng)者狀態(tài) |
becomeFirstResponder | 彈出鍵盤(pán)第一響應(yīng)者狀態(tài) |
createWithFrame | 創(chuàng)建,并指定其Frame |
createWithCenter | 創(chuàng)建,并設(shè)置其Center |
init | 初始化 |
setMarginImageLeft | 設(shè)置左邊緣圖像 |
setMarginImageRight | 設(shè)置右邊緣圖像 |
setBackgroundImage | 設(shè)置背景圖像 |
CATextField 屬性說(shuō)明
類(lèi)型:CATextFieldDelegate*
解釋?zhuān)簲?shù)據(jù)代理,set/get{}。
類(lèi)型:ClearButtonMode
解釋?zhuān)?span>添加按鈕模式,set/get{}。
typedef enum
{
None = 0, //正常模式,不添加按鈕
WhileEditing //添加清除按鈕
}ClearButtonMode;
類(lèi)型:int
解釋?zhuān)鹤筮吘墸ㄈ绻x擇默認(rèn):左16,右16),set/get{}。
類(lèi)型:int
解釋?zhuān)河疫吘墸ㄈ绻x擇默認(rèn):左16,右16),set/get{}。
類(lèi)型:int
解釋?zhuān)鹤煮w大小,set/get{}。
類(lèi)型:std::string
解釋?zhuān)篜laceHolder文本內(nèi)容,set/get{}。
類(lèi)型:CAColor4B
解釋?zhuān)篜laceHolder文本內(nèi)容顏色,set/get{}。
類(lèi)型:std::string
解釋?zhuān)何谋緝?nèi)容,set/get{}。
類(lèi)型:CAColor4B
解釋?zhuān)何谋緝?nèi)容顏色,set/get{}。
類(lèi)型:KeyboardType
解釋?zhuān)烘I盤(pán)類(lèi)型,set/get{}。(默認(rèn)為KeyboardTypeDefault類(lèi)型)
typedef enum
{
Default = 0,
NumbersAndPunctuation,
URL,
NumberPad,
PhonePad,
NamePhonePad,
EmailAddress,
}KeyboardType;
類(lèi)型:ReturnType
解釋?zhuān)篟eturn鍵類(lèi)型,set/get{}。(默認(rèn)ReturnTypeDone類(lèi)型)
typedef enum
{
Done=0,
Go,
Next,
Search,
Send
}ReturnType;
類(lèi)型:TextFieldAlign
解釋?zhuān)篢extField的對(duì)齊方式,set/get{}。(默認(rèn):中心)
typedef enum
{
Left,
Center,
Right
}TextFieldAlign;
類(lèi)型:bool
解釋?zhuān)涸O(shè)置TextField為密碼輸入框,is/set{}。(密碼輸入框,默認(rèn)為假)
類(lèi)型:bool
解釋?zhuān)悍祷劓I恢復(fù)鍵盤(pán),is/set{}。(返回鍵恢復(fù)鍵盤(pán),默認(rèn)為真)
類(lèi)型:int
解釋?zhuān)鹤畲箝L(zhǎng)度,set/get{}。
CATextField 方法說(shuō)明
virtual bool resignFirstResponder();
返回值:bool
參數(shù):
解釋?zhuān)弘[藏鍵盤(pán)第一響應(yīng)者狀態(tài)
virtual bool becomeFirstResponder();
返回值:bool
參數(shù):
解釋?zhuān)簭棾鲦I盤(pán)第一響應(yīng)者狀態(tài)
static CATextField* createWithFrame(const DRect& frame);
返回值:CATextField*
參數(shù):
類(lèi)型 | 參數(shù)名 | 說(shuō)明 |
const DRect& | frame | 區(qū)域大小 |
解釋?zhuān)簞?chuàng)建,并指定其Frame
static CATextField* createWithCenter(const DRect& rect);
返回值:CATextField*
參數(shù):
類(lèi)型 | 參數(shù)名 | 說(shuō)明 |
const DRect& | rect | 中心點(diǎn)的位置及大小 |
解釋?zhuān)簞?chuàng)建,并設(shè)置其Center
返回值:bool
參數(shù):
解釋?zhuān)撼跏蓟?/span>
void setMarginImageLeft(const DSize& imgSize,const std::string& filePath);
返回值:void
參數(shù):
類(lèi)型 | 參數(shù)名 | 說(shuō)明 |
const DSize& | imgSize | 圖像大小 |
const std::string& | filePath | 圖像路徑 |
解釋?zhuān)涸O(shè)置左邊緣圖像
void setMarginImageRight(const DSize& imgSize,const std::string& filePath);
返回值:void
參數(shù):
類(lèi)型 | 參數(shù)名 | 說(shuō)明 |
const DSize& | imgSize | 圖像大小 |
const std::string& | filePath | 圖像路徑 |
解釋?zhuān)涸O(shè)置右邊緣圖像
void setBackgroundImage(CAImage* image);
返回值:void
參數(shù):
類(lèi)型 | 參數(shù)名 | 說(shuō)明 |
CAImage* | image | 圖像 |
解釋?zhuān)涸O(shè)置背景圖像
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: