UIButton 详解
来源:互联网 发布:mysql 时间虚表 编辑:程序博客网 时间:2024/06/05 11:56
UIButton 详解
http://www.cnblogs.com/sell/archive/2013/02/04/2891769.html
1 UIButton *bt = [UIButton buttonWithType:UIButtonTypeContactAdd];// UIButtonTypeCustom, UIButtonTypeRoundedRect; // 2 [bt setTitle:@"myButton" forState:UIControlStateNormal]; // 普通状态 3 [bt setTitle:@"Button1" forState:UIControlStateHighlighted]; // 触摸时 4 [bt setTitle:@"disButton" forState:UIControlStateDisabled]; // 无效时 5 [bt setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; // 普通状态下的字体颜色 6 7 bt.titleLabel.font = [UIFont boldSystemFontOfSize:24]; // 按钮字体 8 bt.titleLabel.shadowOffset = CGSizeMake(1, 1); 9 bt.titleLabel.shadowColor = [UIColor redColor];10 11 12 [bt setImage:[UIImage imageNamed:@"normal.png"] forState:UIControlStateNormal];13 // 普通状态下图片,只在UIButtonTypeCustom,UIButtonTypeRoundedRect下有效14 [bt setBackgroundImage:[UIImage imageNamed:@"background.png"] forState:UIControlStateNormal]; // 设置背景图15 16 UIEdgeInsets insets; // 设置按钮内部图片间距17 insets.top = insets.bottom = insets.right = insets.left = 10;18 bt.contentEdgeInsets = insets;19 20 bt.titleEdgeInsets = insets; // 标题间距21 22 [bt addTarget:self23 action:@selector(click:)24 forControlEvents:UIControlEventTouchUpInside]; // 添加事件响应
0 0
- UIButton 详解
- UIButton 详解
- UIButton 详解
- UIButton 详解
- UIButton详解
- UIButton详解
- UIButton详解
- UIButton 详解
- UIButton详解
- UIButton详解
- UIButton 详解
- UIButton详解
- UIButton详解
- UIButton详解
- UIButton详解
- UIButton详解
- UIButton详解
- UIButton详解(备忘)
- 守护进程的设计与实现
- 微信在中国“抢了微博的风头”
- [前端] sublime text3 新建片段
- 《c陷阱与缺陷》笔记--函数指针
- NDK插件下载设置步骤
- UIButton 详解
- POJ题目分类
- Linux下3G卡片在开发板上的详细解决方法(适用于大多数3G卡片)
- Android LayoutInflater详解
- Ubuntu下解压rar文件的方法
- 如何设置MySQL远程连接
- apache common 工具
- IBM面试记
- hadoop伪分布式配置