UIButton 设置圆角 边框颜色 点击回调方法
2014-03-22 19:36
453 查看
UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom];
signBtn.frame = CGRectMake(0, 0, 80, 40);
[signBtn.layer setMasksToBounds:YES];
[signBtn.layer setCornerRadius:10.0];
//设置矩形四个圆角半径
[signBtn.layer setBorderWidth:1.0];
//边框宽度
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 });
[signBtn.layer setBorderColor:colorref];//边框颜色
[signBtn
setTitle:@"还 原"
forState:UIControlStateNormal];//button title
[signBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];//title color
[signBtn addTarget:self action:@selector(buttonDonwRecover:) forControlEvents:UIControlEventTouchUpInside];//button 点击回调方法
signBtn.backgroundColor = [UIColor whiteColor];
- (void)buttonDonwRecover:(id)sender
{
UIButton *btn = (UIButton *)sender;
}
signBtn.frame = CGRectMake(0, 0, 80, 40);
[signBtn.layer setMasksToBounds:YES];
[signBtn.layer setCornerRadius:10.0];
//设置矩形四个圆角半径
[signBtn.layer setBorderWidth:1.0];
//边框宽度
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 });
[signBtn.layer setBorderColor:colorref];//边框颜色
[signBtn
setTitle:@"还 原"
forState:UIControlStateNormal];//button title
[signBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];//title color
[signBtn addTarget:self action:@selector(buttonDonwRecover:) forControlEvents:UIControlEventTouchUpInside];//button 点击回调方法
signBtn.backgroundColor = [UIColor whiteColor];
- (void)buttonDonwRecover:(id)sender
{
UIButton *btn = (UIButton *)sender;
}
相关文章推荐
- UIView加边框及边框颜色
- 关于tableviewcell的一些属性
- UISearchBar 自定义,加背景,取消按钮背景
- 判断滑动方向UITableView
- UE4学习笔记_01
- UITableView UITableViewStylePlain模型下 取消headerView的黏结性
- window.open("url?param="+paramvalue) 服务端 乱码问题解决
- 交互设计、信息图、信息可视化、数据可视化技术资源汇总——设计师的领域,设计师说了算
- xml读取异常Invalid byte 1 of 1-byte UTF-8 sequence
- Request 分别获取具有相同 name 属性表单元素值
- Android UI开发第四十一篇——墨迹天气3.0引导界面及动画实现
- 多线程下NSOperation、NSBlockOperation、NSInvocationOperation、NSOperationQueue的使用
- iOS学习之UINavigationController详解与使用(三)ToolBar
- iOS学习之UINavigationController详解与使用(三)ToolBar
- EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他
- 获取UIview的viewcontroller
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
- iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem
- iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem