Commit 584e8fda by Daniel Dahan

development: updated TextField rules for Swift 3

parent 55ab6425
......@@ -38,12 +38,13 @@ extension UITabBarItem {
}
@IBDesignable
public class BottomTabBar: UITabBar {
open class BottomTabBar: UITabBar {
/// 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.
@IBInspectable public override var backgroundColor: UIColor? {
@IBInspectable
open override var backgroundColor: UIColor? {
didSet {
barTintColor = backgroundColor
}
......@@ -70,17 +71,17 @@ public class BottomTabBar: UITabBar {
prepareView()
}
public override func layoutSublayers(of layer: CALayer) {
open override func layoutSublayers(of layer: CALayer) {
super.layoutSublayers(of: layer)
if self.layer == layer {
layoutShape()
}
}
public override func layoutSubviews() {
open override func layoutSubviews() {
super.layoutSubviews()
layoutShadowPath()
if let v: Array<UITabBarItem> = items {
if let v = items {
for item in v {
if .phone == Device.userInterfaceIdiom {
if nil == item.title {
......@@ -90,41 +91,39 @@ public class BottomTabBar: UITabBar {
let inset: CGFloat = 6
item.titlePositionAdjustment.vertical = -inset
}
} else {
if nil == item.title {
let inset: CGFloat = 9
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
} else {
let inset: CGFloat = 3
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
item.titlePositionAdjustment.vertical = -inset
}
}
} else if nil == item.title {
let inset: CGFloat = 9
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
} else {
let inset: CGFloat = 3
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
item.titlePositionAdjustment.vertical = -inset
}
}
}
}
public override func didMoveToSuperview() {
open override func didMoveToSuperview() {
super.didMoveToSuperview()
if autoLayoutToSuperview {
if let v: UIView = superview {
if isAlignedToParentAutomatically {
if let v = superview {
_ = v.layout(self).bottom().horizontally()
}
}
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public func prepareView() {
depthPreset = .depth1
contentScaleFactor = Device.scale
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
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