Appearance tweaks
This commit is contained in:
@@ -25,7 +25,7 @@ class TabView: UIControl
|
||||
|
||||
addSubview(label)
|
||||
label.text = "Tab View"
|
||||
label.font = .boldSystemFont(ofSize: 11.0)
|
||||
label.font = .systemFont(ofSize: 11.0)
|
||||
|
||||
addSubview(closeButton)
|
||||
closeButton.setImage(UIImage(systemName: "xmark.square.fill"), for: .normal)
|
||||
@@ -53,16 +53,16 @@ class TabView: UIControl
|
||||
let closeButtonPadding = CGFloat(5.0)
|
||||
let closeButtonSize = CGSize(width: bounds.height, height: bounds.height)
|
||||
closeButton.frame = CGRect(
|
||||
x: insetBounds.width - closeButtonSize.height, y: 0.0,
|
||||
x: (insetBounds.width - closeButton.imageView!.image!.size.height).rounded(), y: 0.0,
|
||||
width: closeButtonSize.width, height: closeButtonSize.height
|
||||
)
|
||||
|
||||
var xOffset = insetBounds.minX
|
||||
var xOffset = layoutMargins.left
|
||||
imageView.frame = CGRect(
|
||||
x: xOffset, y: insetBounds.minY,
|
||||
width: insetBounds.height, height: insetBounds.height
|
||||
)
|
||||
xOffset += imageView.frame.width + 12.0
|
||||
xOffset += imageView.frame.width + 8.0
|
||||
|
||||
label.frame = CGRect(
|
||||
x: xOffset, y: insetBounds.minY,
|
||||
@@ -80,6 +80,11 @@ class TabView: UIControl
|
||||
width: separatorWidth, height: bounds.height
|
||||
)
|
||||
|
||||
let alphaMod = !active ? 0 : 1.0
|
||||
label.alpha = CGFloat.maximum(alphaMod, 0.4)
|
||||
imageView.alpha = CGFloat.maximum(alphaMod, 0.4)
|
||||
closeButton.alpha = CGFloat.maximum(alphaMod, 0.5)
|
||||
|
||||
if isTracking {
|
||||
backgroundColor = .systemFill
|
||||
} else if active {
|
||||
@@ -87,7 +92,7 @@ class TabView: UIControl
|
||||
if traitCollection.userInterfaceStyle == .light {
|
||||
return .secondarySystemGroupedBackground
|
||||
} else {
|
||||
return .secondarySystemFill
|
||||
return .secondarySystemGroupedBackground
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@@ -95,7 +100,7 @@ class TabView: UIControl
|
||||
if traitCollection.userInterfaceStyle == .light {
|
||||
return .secondarySystemFill
|
||||
} else {
|
||||
return .secondarySystemGroupedBackground
|
||||
return UIColor(white: 0.1, alpha: 1.0)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -292,7 +297,7 @@ class TabBarView: UIView
|
||||
tabView.frame = CGRect(
|
||||
x: xOffset,
|
||||
y: tabContainerBounds.minY,
|
||||
width: tabView.collapsed ? 1.0 : tabWidth,
|
||||
width: tabView.collapsed ? 0.0 : tabWidth,
|
||||
height: tabContainerBounds.height
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user