2010-06-30 48 views
0

我使用Three20庫中的TTTextBarController。TTTextBarController字符數

我想統計在這個控件中要寫入的字符數。 並且必須將字符的最大數量限制爲500. 用戶不應超過500個字符。

我該如何做到這一點。

問候

回答

0

解決

int len = textBar.textEditor.text.length; 
NSLog(@" len = %d", len); 
if (len >=160) { 
    //do something here 
} else { 
    //do something here 
}