zoukankan      html  css  js  c++  java
  • UIButton的圆角

    _interestedBtn = [UIButton buttonWithType:UIButtonTypeCustom];

        _interestedBtn.layer.cornerRadius = 8;

        _interestedBtn.layer.borderColor = [UIColor orangeColor].CGColor;

        _interestedBtn.layer.borderWidth = 1;

        _interestedBtn.layer.masksToBounds = YES;

        [_interestedBtn setTitle:@"感兴趣" forState:UIControlStateNormal];

        [_interestedBtn setTitle:@"已感兴趣" forState:UIControlStateSelected];

        [_interestedBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];

        [_interestedBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateSelected];

        [_interestedBtn addTarget:self action:@selector(interestedBtnAction:) forControlEvents:UIControlEventTouchUpInside];

        [self.contentView addSubview:_interestedBtn];

    -(void)interestedBtnAction:(UIButton *)sender{

        sender.selected = !sender.selected;

        

        if (sender.selected) {

            _interestedBtn.layer.cornerRadius = 8;

            _interestedBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;

            _interestedBtn.layer.borderWidth = 1;

            _interestedBtn.layer.masksToBounds = YES;

        }else{

            _interestedBtn.layer.cornerRadius = 8;

            _interestedBtn.layer.borderColor = [UIColor orangeColor].CGColor;

            _interestedBtn.layer.borderWidth = 1;

            _interestedBtn.layer.masksToBounds = YES;

        }

    }

    1
  • 相关阅读:
    POJ 2407 Relatives 欧拉函数
    HDU 4704 Sum 超大数幂取模
    HDU 4699 Editor 维护栈
    HDU 4696 Answers 水题
    HDU 4686 Arc of Dream 矩阵
    [转]高斯消元题集
    [转]计算几何题集
    POJ 2981 Strange Way to Express Integers 模线性方程组
    Linux 设置文件默认打开方式
    FZU 1402 猪的安家 中国剩余定理
  • 原文地址:https://www.cnblogs.com/fantasy3588/p/5539166.html
Copyright © 2011-2022 走看看