34 lines
892 B
Swift
34 lines
892 B
Swift
//
|
|
// gp_uiview.swift
|
|
// Hthik
|
|
//
|
|
// Created by 忆海16 on 2024/5/31.
|
|
// Copyright © 2024 Hthik. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class ViewModifier {
|
|
|
|
// 设置视图的圆角
|
|
static func setCornerRadius(of view: UIView, radius: CGFloat) {
|
|
view.layer.cornerRadius = radius
|
|
view.clipsToBounds = true
|
|
}
|
|
|
|
// 设置视图的边框
|
|
static func setBorder(of view: UIView, color: UIColor, width: CGFloat) {
|
|
view.layer.borderColor = color.cgColor
|
|
view.layer.borderWidth = width
|
|
}
|
|
|
|
// 设置视图的阴影
|
|
static func setShadow(of view: UIView, color: UIColor, opacity: Float, offset: CGSize, radius: CGFloat) {
|
|
view.layer.shadowColor = color.cgColor
|
|
view.layer.shadowOpacity = opacity
|
|
view.layer.shadowOffset = offset
|
|
view.layer.shadowRadius = radius
|
|
}
|
|
}
|