75d24c15
yangbin
123
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
//
// UIButton+Extension.swift
// zc
//
// Created by wyp on 2020/10/20.
// Copyright © 2020 wyp. All rights reserved.
//
import UIKit
public extension UIButton {
func borderColor(_ color: UIColor, cornerRadius: CGFloat = 4) {
layoutIfNeeded()
// let button = UIButton()
self.frame = self.bounds
self.layer.cornerRadius = cornerRadius
self.layer.borderWidth = 1
self.layer.borderColor = color.cgColor
self.layer.masksToBounds = true
// self.titleLabel?.font = font
self.titleLabel?.textAlignment = .center
// self.setTitleColor(color, for: .normal)
}
func setColor(radio: CGFloat, color: UIColor, borderColor: UIColor, textColor: UIColor, text: String) {
self.layer.borderWidth = 0.5
self.layer.borderColor = borderColor.cgColor
self.backgroundColor = color
self.setTitle(text, for: .normal)
self.setTitleColor(textColor, for: .normal)
self.layer.cornerRadius = radio
}
}
|