Skip to content

Commit

Permalink
Merge pull request #120 from devmjun/feature/add_cornerRadius_value_o…
Browse files Browse the repository at this point in the history
…n_underlineFocusView

Add cornerRadius value on UnderlineFocusView
  • Loading branch information
kazuhiro4949 authored Apr 22, 2020
2 parents cb1401f + 5b0f013 commit 21fc974
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions PagingKit/Menu Cells/Underline/UnderlineFocusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class UnderlineFocusView: UIView {
underlineView.backgroundColor = underlineColor
}
}

/// The color of underline
public var underlineHeight = CGFloat(4) {
didSet {
Expand All @@ -45,15 +45,25 @@ public class UnderlineFocusView: UIView {

public var underlineWidth: CGFloat? = nil {
didSet {
if let underlineWidth = underlineWidth {
widthConstraint.isActive = true
widthConstraint.constant = underlineWidth
} else {
widthConstraint.isActive = false
}
if let underlineWidth = underlineWidth {
widthConstraint.isActive = true
widthConstraint.constant = underlineWidth
} else {
widthConstraint.isActive = false
}
}
}

public var masksToBounds: Bool {
get { return underlineView.layer.masksToBounds }
set { underlineView.layer.masksToBounds = newValue }
}

public var cornerRadius: CGFloat {
get { return underlineView.layer.cornerRadius }
set { underlineView.layer.cornerRadius = newValue }
}

private let widthConstraint: NSLayoutConstraint
private let heightConstraint: NSLayoutConstraint
private let underlineView = UIView()
Expand Down Expand Up @@ -97,7 +107,7 @@ public class UnderlineFocusView: UIView {
super.init(frame: frame)
setup()
}

private func setup() {
addSubview(underlineView)
underlineView.translatesAutoresizingMaskIntoConstraints = false
Expand Down

0 comments on commit 21fc974

Please sign in to comment.