您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页iOS 基本控件之UITextView的基本用法

iOS 基本控件之UITextView的基本用法

来源:化拓教育网

// 设置它显示的内容

_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."; 

// 设置字体名字和字体大小

_textView.font = [UIFont fontWithName:@"Arial" size:18.0]; 

// 设置textview里面的字体颜色

_textView.textColor = [UIColor blackColor]; 

// textView中的文本排列,默认靠左

_textView.textAlignment = NSTextAlignmentCenter; 

// 设置浅灰色的背景色,默认为白色

_textView.backgroundColor = [UIColor grayColor]; 

// 设置代理

_textView.delegate = self; 

 // textView是否可被输入,默认为YES

_textView.editable = NO;

// 可以方便将文本插入到UITextView中。

_textView.attributedText = [[NSAttributedString alloc]initWithString:@"attributedText__-abc"]; 

// 弹出视图,默认为键盘

_textView.inputView = [[UIDatePicker alloc]init]; 

// 弹出视图上方的辅助视图

_textView.inputAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 

// clearsOnInsertion,默认为NO,清除之前输入的文本

_textView.clearsOnInsertion = YES; 

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务