Commit 584e8fda by Daniel Dahan

development: updated TextField rules for Swift 3

parent 55ab6425
...@@ -38,12 +38,13 @@ extension UITabBarItem { ...@@ -38,12 +38,13 @@ extension UITabBarItem {
} }
@IBDesignable @IBDesignable
public class BottomTabBar: UITabBar { open class BottomTabBar: UITabBar {
/// Automatically aligns the BottomNavigationBar to the superview. /// Automatically aligns the BottomNavigationBar to the superview.
public var autoLayoutToSuperview: Bool = true open var isAlignedToParentAutomatically = true
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable
open override var backgroundColor: UIColor? {
didSet { didSet {
barTintColor = backgroundColor barTintColor = backgroundColor
} }
...@@ -70,17 +71,17 @@ public class BottomTabBar: UITabBar { ...@@ -70,17 +71,17 @@ public class BottomTabBar: UITabBar {
prepareView() prepareView()
} }
public override func layoutSublayers(of layer: CALayer) { open override func layoutSublayers(of layer: CALayer) {
super.layoutSublayers(of: layer) super.layoutSublayers(of: layer)
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
} }
} }
public override func layoutSubviews() { open override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
layoutShadowPath() layoutShadowPath()
if let v: Array<UITabBarItem> = items { if let v = items {
for item in v { for item in v {
if .phone == Device.userInterfaceIdiom { if .phone == Device.userInterfaceIdiom {
if nil == item.title { if nil == item.title {
...@@ -90,8 +91,7 @@ public class BottomTabBar: UITabBar { ...@@ -90,8 +91,7 @@ public class BottomTabBar: UITabBar {
let inset: CGFloat = 6 let inset: CGFloat = 6
item.titlePositionAdjustment.vertical = -inset item.titlePositionAdjustment.vertical = -inset
} }
} else { } else if nil == item.title {
if nil == item.title {
let inset: CGFloat = 9 let inset: CGFloat = 9
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0) item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
} else { } else {
...@@ -102,12 +102,11 @@ public class BottomTabBar: UITabBar { ...@@ -102,12 +102,11 @@ public class BottomTabBar: UITabBar {
} }
} }
} }
}
public override func didMoveToSuperview() { open override func didMoveToSuperview() {
super.didMoveToSuperview() super.didMoveToSuperview()
if autoLayoutToSuperview { if isAlignedToParentAutomatically {
if let v: UIView = superview { if let v = superview {
_ = v.layout(self).bottom().horizontally() _ = v.layout(self).bottom().horizontally()
} }
} }
...@@ -124,7 +123,7 @@ public class BottomTabBar: UITabBar { ...@@ -124,7 +123,7 @@ public class BottomTabBar: UITabBar {
depthPreset = .depth1 depthPreset = .depth1
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
backgroundColor = Color.white backgroundColor = Color.white
let image: UIImage? = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1)) let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1))
shadowImage = image shadowImage = image
backgroundImage = image backgroundImage = image
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment