UITextView控件属性

UITextView控件属性:

1.text: 设置textView中文本
_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中文字的字体
_textView.font = [UIFont fontWithName:@"Arial" size:18.0]; // 设置字体名字和字体大小

3.textColor:设置textView中文本的颜色
_textView.textColor = [UIColor blackColor]; // 设置textview里面的字体颜色

4.textAlignment:设置textView的文本的排列方式
_textView.textAlignment = NSTextAlignmentCenter; // textView中的文本排列,默认靠左

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

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

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

8.attributedText:设置默认插入textView的文字
_textView.attributedText = [[NSAttributedString alloc]initWithString:@"attributedText__-abc"]; // 可以方便将文本插入到UITextView中。

9.inputView:设置从底部弹出的视图
_textView.inputView = [[UIDatePicker alloc]init]; // 弹出视图,默认为键盘

10.inputAccessoryView:设置弹出视图上方的辅助视图
_textView.inputAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; // 弹出视图上方的辅助视图

11.clearsOnInsertion:设置textView获得焦点,在用户使用虚拟键盘进行输入时,清除之前的文本
_textView.clearsOnInsertion = YES; // clearsOnInsertion,默认为NO
时间: 2024-08-08 13:45:23

UITextView控件属性的相关文章

控件属性设置

控件属性设置 XIB中设置UILabel文字居中 选中位于视图下方的Label对象,单击检视面板选择条中的Attributes Inspector图标,打开属性面板.在属性面板中找到标题为Alignment的分段控件(seg-mented control).选择中间的那个选项(居中对齐),如图所示. 改变按钮的背景颜色 在属性检视面板中向下滚动,会看到View标题下方的属性.在Background标签右侧,点击颜色面板(白色方块,上面有一条红色的斜线)可以打开颜色拾取器.

第三篇:属性_第一节:控件属性与属性的持久化

一.控件属性 首先,属性是各种.net语言的基本语法.而我们常说的控件属性是指控件类中用public修饰的属性. 见Lable的Text属性: [Bindable(true), DefaultValue(""), Localizable(true), PersistenceMode(PersistenceMode.InnerDefaultProperty), WebCategory("Appearance"), WebSysDescription("Lab

UITextField控件属性

UITextField控件属性: enablesReturnKeyAutomatically 默认为No,如果设置为Yes,文本框中没有输入任何字符的话,右下角的返回按钮是disabled的. 1.borderStyle 设置边框样式,只有设置了才会显示边框样式 text.borderStyle = UITextBorderStyleRoundedRect; typedef enum { UITextBorderStyleNone, UITextBorderStyleLine, UITextBo

UIView控件属性

UIView控件属性: 1.alpha 设置视图的透明度.默认为1. // 完全透明 view.alpha = 0; // 不透明 view.alpha = 1; 2.clipsToBounds // 默认是NO,当设置为yes时,超出当前视图的尺寸的内容和子视图不会显示. view.clipsToBounds = YES; 3.hidden // 默认是NO,当设置为yes,视图就看不见了. view.hidden = YES; 4.userInteractionEnabled // 默认为Y

UISwitch控件属性

UISwitch控件属性: 1. onTintColor 处于on时switch 的颜色 switchImage.onTintColor = [UIColor grayColor]; 2.tintColor 处于off时switch 的颜色 switchImage.tintColor = [UIColor greenColor]; 3.onImage 设置on 的图标 switchImage.onImage = [UIImage imageNamed:@"1.png"]; 4. off

UIButton控件属性

UIButton控件属性: 1.UIButton状态: UIControlStateNormal // 正常状态 UIControlStateHighlighted // 高亮状态 UIControlStateDisabled // 禁用状态 UIControlStateSelected // 选中状态 UIControlStateApplication // 应用状态 UIControlStateReserved // 保留状态 2.Uibutton类型: UIButtonTypeCustom

WPF利用通过父控件属性来获得绑定数据源RelativeSource

WPF利用通过父控件属性来获得绑定数据源RelativeSource 有时候我们不确定作为数据源的对象叫什么名字,但知道作为绑定源与UI布局有相对的关系,如下是一段XAML代码,说明多层布局控件中放置一个文本控件,来显示父级控件的名称. 1.XAML Html代码 <Grid x:Name="g1" Background="Red" Margin="10"> <DockPanel x:Name="d1" Ba

2017-4-25 公共控件属性 菜单和工具栏属性

(一)公共控件属性 1.Button按钮 AutoSize  内容自适应大小 Location  控件左上角相对于容器左上角的位置 Margin  控件与控件的外边距 Enabled  控件是否可以选中 TabIndex   布局用 TabStop 布局用 Visible    是否显示 FlatAppearance  FlatStyle  2个属性配合使用,可以控制按钮的边框样式等 2.CheckBox checked  是否被选中 Appearance 外观样式 CheckAlign   复

visual studio开发工具的C#主流控件属性一览表

visual studio开发工具的C#主流控件属性一览表 详细的介绍了各控制属性的详细中文介绍 C#控件及常用设计整理 1.窗体 1.常用属性 (1)Name属性:用来获取或设置窗体的名称,在应用程序中可通过Name属性来引用窗体. (2) WindowState属性: 用来获取或设置窗体的窗口状态. 取值有三种: Normal (窗体正常显示). Minimized(窗体以最小化形式显示)和 Maximized(窗体以最大化形式显示). (3)StartPosition属性:用来获取或设置运