UILabel-UITextField-UIBottonamp;nbsp;UI_…
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
UIView *contentView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
contentView.backgroundColor = [UIColor brownColor];
2.配置属性
3.添加到父视图上
4.释放所有权release
//2.配置UILabel的属性
//2.1 配置背景颜色
[label setBackgroundColor:[UIColor cyanColor]];
//2.2 设置显示的文字
label.text = @"欢迎进入QQ登录界面";
//2.3 设置文字的颜色
label.textColor = [UIColor redColor];
//2.4 设置文本居中
label.textAlignment = NSTextAlignmentCenter;
//2.5 设置文字大小
label.font = [UIFont systemFontOfSize:30];
//字体采用加粗的字体样式
label.font = [UIFont boldSystemFontOfSize:25];
//UIFont是一个字体
//2.6 设置文本的行数
label.numberOfLines = 0;//设置为0,表示不限制行数,默认为1行
//2.7 行数的截取方式
//NSLineBreakByWordWrapping通过单词截取
//2.8 设置阴影颜色
label.shadowColor = [UIColor blackColor];
//2.9 阴影的偏移量
label.shadowOffset = CGSizeMake(1, 2);
//2.10 设置文本的对齐方式
label.textAlignment = NSTextAlignmentCenter;
//NSTextAlignmentLeft 左对齐
//NSTextAlignmentRight 右对齐
//NSTextAlignmentCenter 居中对齐
[contentView addSubview:label];
//4.释放所有权
[label release];
UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(80, 200, 200, 30)];
//2.配置属性
//shift + command +k 收回和放出键盘
textField.backgroundColor = [UIColor whiteColor];
//文本框类型
textField.borderStyle = UITextBorderStyleRoundedRect;
//2.2 设置文本框的提示文字
textField.placeholder = @"请输入账号";
//2.3 设置输入框文本
textField.text = @"12345";
//2.4 设置输入文本颜色,只影响输入框输入文本的颜色
textField.textColor = [UIColor redColor];
//2.5 设置文本框的对齐格式
textField.textAlignment = NSTextAlignmentLeft;
//2.6 设置文本输入框的是否可编辑
// textField.enabled = NO;//默认可编辑YES;
//关闭用户交互
// textField.userInteractionEnabled = NO;
//2.8 设置键盘弹出格式
textField.keyboardType = UIKeyboardTypeNumberPad;//纯数字键盘
textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
//2.9 设置return键的格式
textField.returnKeyType = UIReturnKeyDone;
//2.10 设置文本输入框是否以加密的形式显示,默认是NO;
textField.secureTextEntry = YES;
//3.添加到父视图
[contentView addSubview:textField];
//4.释放所有权
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
//UIButtonTypeDetailDisclosure 详细信息(浅色背景)
//UIButtonTypeInfoDark 详细信息(深色背景)
//UIButtonTypeInfoLight 详细信息(浅色背景)
//UIButtonTypeSystem 系统样式
//UIButtonTypeContactAdd 加号按钮
//UIButtonTypeCustom 自定义格式,需要添加图片的时候需要使用此种类型
//2.配置属性
button.backgroundColor = [UIColor greenColor];
//2.2 设置button的frame
button.frame = CGRectMake(10, 300, 300, 60);
//2.3 给button切圆角
button.layer.cornerRadius = 15;
[button setTitle:@"正常状态" forState:UIControlStateNormal];
[button setTitle:@"高亮状态" forState:UIControlStateHighlighted];
[button setTitle:@"选中状态" forState:UIControlStateSelected];
//默认是可用状态YES;
// button.enabled = NO;
//2.6 设置button 是否处于选中状态
//默认是处于没有选中状态NO,设置为YES处于选中状态
//button 是一个复合视图(有多个视图构成的视图),其中titleLable 是标题,用来显示标题,还有一个imageView,用来显示图片
button.tintColor = [UIColor redColor];
//2.9 设置button的imageView的图片
//UIImage是一个图片类,继承自NSObject
//创建UIImage对象
// UIImage *image = [UIImage imageNamed:@"1"];//只有png格式后缀的图片不写后缀,其他的都要写后缀
//
// [button setImage:image forState:UIControlStateNormal ];
//2.10 设置button背景图片
//3.添加到父视图上
[self.window addSubview:button];
UIImage *image2 = [UIImage imageNamed:@"2.jpg"];
[button setBackgroundImage:image2 forState:UIControlStateNormal];
UIImage *image3 = [UIImage imageNamed:@"3.jpg"];
[button setBackgroundImage:image3 forState:UIControlStateHighlighted];
//buttond的关联时间
//Target :button指定的响应的对象
//action : 指定相应对象调用的方法,方法用来处理button点击事件
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
NSLog(@"鼓掌");
contenView.tag = 100;
[lable release];
//建一个UItextField
UITextField *field = [[UITextField alloc]initWithFrame:CGRectMake(100, 300, 200, 60)];
field.backgroundColor = [UIColor whiteColor];
field.tag = 102;
field.borderStyle = UITextBorderStyleRoundedRect;
field.textColor = [UIColor redColor];
[contenView addSubview:field];
[field release];
//建一个button的按钮
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(150, 400, 100, 60);
button.tintColor = [UIColor magentaColor];
[button setTintColor:[UIColor blackColor]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
欢迎学习本文档,未经博主允许,不得私自转载!
UILabel-UITextField-UIBottonamp;nbsp;UI_…相关推荐
- 控件 UIView UILabel UITextField UITextView UIButton ;的字体、大小、单位、颜色
转自:http://www.tuicool.com/articles/QZ3If2 //学习内容/*1.控件 UIView UILabel UITextField UITextView UIButto ...
- IOS控件学习:UILabel常用属性与用法
#import "ViewController.h" #import <CoreText/CoreText.h>@interface ViewController () ...
- iOS自学-UILabel常见属性
#import "ViewController.h" #import <CoreText/CoreText.h>@interfaceViewController ()@ ...
- IOS控件学习:UILabel常用属性与用法(转)
原文链接:http://duchengjiu.iteye.com/blog/2041391 保存下来随时查看,感谢分享. 参考网站: http://shijue.me/show_text/521c39 ...
- UIlabel - 富文本属性
1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFontOfSize:_fontS ...
- UILabel attributedText
#import "ViewController.h" #import <CoreText/CoreText.h>@interface ViewController () ...
- iOS之富文本(二)
之前做项目时遇到一个问题: 使用UITextView显示一段电影的简介,由于字数比较多,所以字体设置的很小,行间距和段间距也很小,一大段文字挤在一起看起来很别扭,想要把行间距调大,结果在XCode中查 ...
- iOS上文本处理之简史
iOS 文字简史 iPhone OS 2 UILabel UITextField UITextView iPhone OS 3 New Feature: 复制 && 粘贴 iOS 3. ...
- iOS中 Animation 动画大全 韩俊强的博客
每日更新关注:http://weibo.com/hanjunqiang 新浪微博! iOS开发者交流QQ群: 446310206 1.iOS中我们能看到的控件都是UIView的子类,比如UIButt ...
- IOS开发-我的第一个IOS程序
学完前面的ObjC基础,那么接下来我可以开始我的IOS开发之旅了- 1.首先打开Xcode创建一个工程 2.选择IOS->Application->SingleView Applicati ...
最新文章
- 1089: [SCOI2003]严格n元树
- Python3 使用 pymysql 连接 MySQL 建表时出现 Warning3719 UTF8 警告
- oracle pl/sql 包
- 大话设计模式-策略模式与简单工厂模式
- c primer英文版第5版_2019足坛10大巨星:梅西第2范戴克第3,C罗第5
- 十分钟带你学会Http协议和Tomcat服务器的原理
- centos 利用yum更新git
- php date()时间不对,PHP DATE( )函数与系统时间差8小时解决办法
- java web 密码加密_JavaWeb日记——Shiro之密码加密
- php自定义生成用户收据,Shopify POS收据自定义操作步骤
- 如何在微信小程序开发中添加组件?
- 计算机日志文件事件ID,系统日志出现事件 ID:16001来源:AFD的警告
- 产品的10大设计原则
- 当NBA球星遇上机器学习……
- 如何把浏览器中知乎文章导出成PDF
- 系统模块化备援 服务器,无法登录到 CMM 以进行英特尔® 模块化服务器系统
- windows上安装detectron2
- 10G 网络变压器 10GBASE-T与1000Base-T区别
- wps打开word是绿色的怎么解决?
- 用百度地图实现添加电子围栏并判断是否在范围内