zoukankan      html  css  js  c++  java
  • iOS开发--UIButton 设置圆角 边框颜色 点击回调方法

     1 UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom];
     2 signBtn.frame = CGRectMake(0, 0, 80, 40);
     3 [signBtn.layer setMasksToBounds:YES];
     4 [signBtn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径
     5 [signBtn.layer setBorderWidth:1.0]; //边框宽度
     6 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
     7 CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 }); 
     8 [signBtn.layer setBorderColor:colorref];//边框颜色
     9 [signBtn setTitle:@"还  原" forState:UIControlStateNormal];//button title
    10 [signBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];//title color
    11 [signBtn addTarget:self action:@selector(buttonDonwRecover:) forControlEvents:UIControlEventTouchUpInside];//button 点击回调方法
    12 signBtn.backgroundColor = [UIColor whiteColor];
  • 相关阅读:
    uva1220--树的最大独立集+判重
    UVA12186--树型DP
    HDU4171--bfs+树
    远程调用
    高并发业务
    wireshark
    将java程序打包成exe文件
    将博客搬至CSDN
    Mysql分区
    MogileFS
  • 原文地址:https://www.cnblogs.com/feiling/p/4716078.html
Copyright © 2011-2022 走看看