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

原创
2016/01/04 17:25
阅读数 70

##继承关系 Inherits From

##1 属性 ###1. text(文本)

_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 (字体)

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

###3. textColor (文本的颜色)

// 设置textview里面的字体颜色
_textView.textColor = [UIColor blackColor]; 

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

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

###5. backgroundColor (背景颜色)

 // 设置浅灰色的背景色,默认为白色
_textView.backgroundColor = [UIColor grayColor];

###6. delegate(设置代理)

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

###7. editable (是否可被输入)

_textView.editable = NO; // textView是否可被输入,默认为YES

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

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

###9. inputView (从底部弹出的视图)

// 弹出视图,默认为键盘
_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

展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部