iOS UIButton各类属性设置大全
来源:互联网 发布:阿里云切换系统 编辑:程序博客网 时间:2024/05/01 22:46
//设置自定义的按钮
//UIButton *button1=[UIButton buttonWithType:UIButtonTypeCustom];
//设置一个圆角的按钮
UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame=CGRectMake(80,250,250, 30);//按钮的位置坐标
[button1 setTitle:@"Button1" forState:UIControlStateNormal];//普通状态按钮标题
[button1 setTitle:@"高亮状态" forState:UIControlStateHighlighted];//高亮状态的按钮标题
//高亮状态光晕效果
[button1 setShowsTouchWhenHighlighted:YES];
//设置标题的颜色
[button1 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//设置标题的字体大小
[button1.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
//设置背景颜色
[button1 setBackgroundColor:[UIColor blueColor]];
//图片被拉伸式地设置背景图片
[button1 setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];
//图片保持原来大小地设置背景图片
//[button1 setImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];
[[button1 titleLabel]setShadowColor:[UIColor blackColor]];
[[button1 titleLabel]setShadowOffset:CGSizeMake(-0.5, -0.5)];
button1.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
[self.view addSubview:button1];
//监听事件
[button1 addTarget:self action:@selector(Click_Button) forControlEvents:UIControlEventTouchUpInside];
}
-(void)Click_Button
{
NSLog(@"已点击...");
}
未完,待续更新.........
//UIButton *button1=[UIButton buttonWithType:UIButtonTypeCustom];
//设置一个圆角的按钮
UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame=CGRectMake(80,250,250, 30);//按钮的位置坐标
[button1 setTitle:@"Button1" forState:UIControlStateNormal];//普通状态按钮标题
[button1 setTitle:@"高亮状态" forState:UIControlStateHighlighted];//高亮状态的按钮标题
//高亮状态光晕效果
[button1 setShowsTouchWhenHighlighted:YES];
//设置标题的颜色
[button1 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//设置标题的字体大小
[button1.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
//设置背景颜色
[button1 setBackgroundColor:[UIColor blueColor]];
//图片被拉伸式地设置背景图片
[button1 setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];
//图片保持原来大小地设置背景图片
//[button1 setImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];
[[button1 titleLabel]setShadowColor:[UIColor blackColor]];
[[button1 titleLabel]setShadowOffset:CGSizeMake(-0.5, -0.5)];
button1.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
[self.view addSubview:button1];
//监听事件
[button1 addTarget:self action:@selector(Click_Button) forControlEvents:UIControlEventTouchUpInside];
}
-(void)Click_Button
{
NSLog(@"已点击...");
}
未完,待续更新.........
1 0
- iOS UIButton各类属性设置大全
- iOS UIButton各类属性设置大全
- iOS UIButton各类属性设置大全
- iOS UIButton各类属性设置大全2
- ios UIButton属性大全
- IOS TextField 属性设置大全
- UIButton 属性设置
- Textview各类属性设置
- iOS UIButton 属性
- iOS UIButton同时设置title和image属性
- iOS UIButton同时设置title和image属性
- iOS之UIButton设置
- iOS UIButton 常用设置
- UIbutton的一些属性设置
- UIButton 的标题属性设置
- UIButton的常用属性设置
- ios UIButton的常用属性
- iOS开发基础 :UIButton属性
- 附加数据库失败:错误:5120
- TC 使用中出现的一个问题
- html之inline inline-block block区别
- linux内核input子系统解析
- source insight的常用配置
- iOS UIButton各类属性设置大全
- html 标签匹配检测/检验---------tidy
- 如何判断一个数是否是质数
- Git - 基础
- 递归法求阶乘图解
- java对象和json对象之间互相转换
- 使用librtmp进行H264与AAC直播
- Android Studio使用第三方类库
- Android21_Handler、Looper消息传递机制