UIButton


btn文字下划线样式


NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"查看所有中奖记录"];  
NSRange strRange = {0,[str length]};  
[str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];  
[self.btn setAttributedTitle:str forState:UIControlStateNormal]; 

btn边框样式


- (UIButton*)btn{
    if (_btn == nil) {
        UIButton * btn = [[UIButton alloc]init];
        // 外边框
        btn.layer.masksToBounds = YES;
        btn.layer.cornerRadius = 2;
        btn.layer.borderWidth = 1;
        //btn.layer.borderColor = PKBtnSelectedColor.CGColor;
        btn.layer.borderColor = [UIColor blueColor].CGColor;        
        // 文字
        btn.titleLabel.textAlignment = NSTextAlignmentCenter;
        //字体大小
        btn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
        //文字内容
        [btn setTitle:@"" forState:UIControlStateNormal];
        //消息回调
        [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        //按钮不同状态下不同背景色
        [btn setBackgroundImage:[UIImage createImageWithColor:PKBtnNormalColor andSize:CGSizeMake(1, 1)] forState:UIControlStateNormal];
        [btn setBackgroundImage:[UIImage createImageWithColor:PKBtnSelectedColor andSize:CGSizeMake(1, 1)] forState:UIControlStateSelected];

        _btn = btn;
    }
    return _btn;
}

样式

image

UILabel


lab普通样式设置


- (UILabel*)minLab{
    if (!_minLab ) {
        UILabel * lab = [[UILabel alloc] init];
        //居中
        lab.textAlignment = NSTextAlignmentCenter;
        //行数限制
        lab.numberOfLines = 1;
        //字体大小
        lab.font = [UIFont systemFontOfSize:14];
        //字体颜色
        lab.textColor = [UIColor blackColor];
        //背景色
        lab.backgroundColor = [UIColor clearColor];
        //透明度
        lab.alpha = 1.0;
        //字体
        lab.text = @"分";
        // 调整大小
        [lab sizeToFit];
        _minLab = lab;
    }
    return _minLab;
}   

样式 (分钟样式)

image