UI 常用方法总结之--- UILabel UITextField (不断更新中)
来源:互联网 发布:淘宝店设置低于7折 编辑:程序博客网 时间:2024/06/05 20:22
UILabel :UIView <NSCoding>
1.创建一个UILabel对象
UILabel *label = [[UILabelalloc]initWithFrame:CGRectMake(30,30, 280,60)];
2.backgroundColor
背景颜色
3.text
显示的文本信息
eg:label.text =@"显示的文本信息";
4.textColor
文本颜色
eg:label.textColor = [UIColoryellowColor];
5.shadowColor
文本阴影颜色
eg:label.shadowColor = [UIColorblueColor];
6.shadowOffset
文本阴影偏移量
eg:label.shadowOffset =CGSizeMake(3, 3);
7.textAlignment
文本格式处理(对齐方式)
eg:label.textAlignment =NSTextAlignmentCenter;
8.lineBreakMode
当文本过长时, label显示的断行方式
eg:label.lineBreakMode =NSLineBreakByTruncatingHead;
9.numberOfLines
控制label显示的行数
eg:label.numberOfLines =0;
10.font
字体大小 系统默认字体大小17
eg:label.font = [UIFontsystemFontOfSize:20];
UITextField :UIControl <UITextInput,NSCoding>
1.创建一个UITextField对象
UITextField *name = [[UITextFieldalloc]initWithFrame:CGRectMake(30,100,280, 30)];
2.placeholder
默认的占位字符串 一旦输入自动隐藏
eg:name.placeholder =@"请在这里输入";
3.secureTextEntry
输入转换为黑点
eg:name.secureTextEntry =YES;
4.keyboardType
更改键盘类型
name.keyboardType =UIKeyboardTypeASCIICapable;
5.borderStyle
外观控制
name.borderStyle =UITextBorderStyleRoundedRect;
6.clearButtonMode
清除按钮
name.clearButtonMode =UITextFieldViewModeWhileEditing;
7.backgroundColor
背景颜色
8.回收键盘操作
[textField resignFirstResponder];
9.- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;
//是否允许输入
10.- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;
//限制输入字符
eg: if ([stringisEqualToString:@"a"]) {
returnNO;
}
NSLog(@"%@",string);
returnYES;
11.- (BOOL)textFieldShouldReturn:(UITextField *)textField;
//返回按钮调用方法
- UI 常用方法总结之--- UILabel UITextField (不断更新中)
- UI 常用方法总结之--- UIWindow UIView (不断更新中)
- UI 常用方法总结之--- UIButton UIAlertView (不断更新中)
- UI 常用方法总结之--- UIViewController UIResponder (不断更新中)
- UI 常用方法总结之--- UIImageView UISlider UISegmentedControl (不断更新中)
- UI 常用方法总结之---各个手势种类 (不断更新中)
- UI 常用方法总结之--- UIScrollView (不断更新中)
- UI 常用方法总结之--- UIPageControl (不断更新中)
- UI 常用方法总结之--- UINavigationController (不断更新中)
- UI 常用方法总结之--- UITableView (不断更新中)
- IOS开发UI系列之常用控件 UILabel, UITextField, UIButton, UIImageView等常用属性与方法
- UI UILabel Button UITextField
- UITextField常用方法总结
- UITextField常用方法总结
- 初始UI(UILabel、UIButton、UITextField)
- Eclipse 插件开发中常用方法总结(不断更新...)
- iOS开发总结之UITextField常用属性和方法
- iOS -- UI常用组件之. UILabel
- 浅谈UML的概念和模型之UML九种图
- 使用webview加载,注意事项
- leetcode - Construct Binary Tree from Preorder and Inorder Traversal
- web.xml 中的listener、 filter、servlet 加载顺序及其详解
- Python宝典第19章:处理HTML与XML
- UI 常用方法总结之--- UILabel UITextField (不断更新中)
- 2014-10-06 让我们一起来对360误报说不!
- wpf 实现实时毛玻璃(live blur)效果
- C++标准库函数
- UVA - 107 The Cat in the Hat
- leetcode Permutation Sequence
- 使用glassfish在linux上的部署网站
- 在C + +实现
- Codeforces 475D CGCDSSQ 求序列中连续数字的GCD=K的对数