01-UI基礎-04-01-UITextView : UIScrollVie

##繼承關係 Inherits Fromhtml

##1 屬性 ###1. text(文本)ios

_textView.text = @"Now is the time for all good developers to come to serve their country.\n\nNow is the time for all good developers to come to serve their country."; // 設置它顯示的內容

###2. font (字體)app

// 設置字體名字和字體大小
_textView.font = [UIFont fontWithName:@"Arial" size:18.0];

###3. textColor (文本的顏色)字體

// 設置textview裏面的字體顏色
_textView.textColor = [UIColor blackColor];

###4. textAlignment (排列方式)代理

// textView中的文本排列,默認靠左
_textView.textAlignment = NSTextAlignmentCenter;

###5. backgroundColor (背景顏色)code

// 設置淺灰色的背景色,默認爲白色
_textView.backgroundColor = [UIColor grayColor];

###6. delegate(設置代理)htm

_textView.delegate = self; // 設置代理

###7. editable (是否可被輸入)繼承

_textView.editable = NO; // textView是否可被輸入,默認爲YES

###8. attributedText (默認插入textView的文字)文檔

// 能夠方便將文本插入到UITextView中。
_textView.attributedText = [[NSAttributedString alloc]initWithString:@"attributedText__-abc"];

###9. inputView (從底部彈出的視圖)get

// 彈出視圖,默認爲鍵盤
_textView.inputView = [[UIDatePicker alloc]init];

###10. inputAccessoryView(設置彈出視圖上方的輔助視圖)

// 彈出視圖上方的輔助視圖
_textView.inputAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

###11. clearsOnInsertion 設置textView得到焦點,在用戶使用虛擬鍵盤進行輸入時,清除以前的文本

_textView.clearsOnInsertion = YES; // clearsOnInsertion,默認爲NO

##官方文檔 https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextView_Class/index.html#//apple_ref/occ/cl/UITextView

相關文章
相關標籤/搜索