swift IB设计的自定义视图
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift IB设计的自定义视图相关的知识,希望对你有一定的参考价值。
//
// SRCustomView.swift
//
// Created by Subhr Roy on 22/09/18.
// Copyright © 2018 Subhr Roy. All rights reserved.
//
import UIKit
@IBDesignable open class SRCustomView: UIView {
@IBInspectable var cornerRadius: CGFloat = 5.0 {
didSet {
layer.cornerRadius = cornerRadius
}
}
@IBInspectable var borderWidth: CGFloat = 1.0 {
didSet {
layer.borderWidth = borderWidth
}
}
@IBInspectable var borderColor : CGColor = UIColor.clear.cgColor{
didSet{
layer.borderColor = borderColor
}
}
override open func layoutSubviews() {
super.layoutSubviews()
clipsToBounds = true
}
}
以上是关于swift IB设计的自定义视图的主要内容,如果未能解决你的问题,请参考以下文章