Commit a3146a47 by Daniel Dahan

updated left and right controls to UIViews

parent 71bdc3ea
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
......
...@@ -54,7 +54,7 @@ public class BarView : ControlView { ...@@ -54,7 +54,7 @@ public class BarView : ControlView {
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightControls: An Array of UIControls that go on the right side.
*/ */
public override init(leftControls: Array<UIControl>? = nil, rightControls: Array<UIControl>? = nil) { public override init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) {
super.init(leftControls: leftControls, rightControls: rightControls) super.init(leftControls: leftControls, rightControls: rightControls)
} }
......
...@@ -85,15 +85,15 @@ public class ControlView : View { ...@@ -85,15 +85,15 @@ public class ControlView : View {
public private(set) var contentView: View! public private(set) var contentView: View!
/// Left side UIControls. /// Left side UIControls.
public var leftControls: Array<UIControl>? { public var leftControls: [UIView]? {
didSet { didSet {
if let v: Array<UIControl> = oldValue { if let v = oldValue {
for b in v { for b in v {
b.removeFromSuperview() b.removeFromSuperview()
} }
} }
if let v: Array<UIControl> = leftControls { if let v = leftControls {
for b in v { for b in v {
addSubview(b) addSubview(b)
} }
...@@ -103,15 +103,15 @@ public class ControlView : View { ...@@ -103,15 +103,15 @@ public class ControlView : View {
} }
/// Right side UIControls. /// Right side UIControls.
public var rightControls: Array<UIControl>? { public var rightControls: [UIView]? {
didSet { didSet {
if let v: Array<UIControl> = oldValue { if let v = oldValue {
for b in v { for b in v {
b.removeFromSuperview() b.removeFromSuperview()
} }
} }
if let v: Array<UIControl> = rightControls { if let v = rightControls {
for b in v { for b in v {
addSubview(b) addSubview(b)
} }
...@@ -149,7 +149,7 @@ public class ControlView : View { ...@@ -149,7 +149,7 @@ public class ControlView : View {
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightControls: An Array of UIControls that go on the right side.
*/ */
public init(leftControls: Array<UIControl>? = nil, rightControls: Array<UIControl>? = nil) { public init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) {
super.init(frame: CGRect.zero) super.init(frame: CGRect.zero)
frame.size = intrinsicContentSize() frame.size = intrinsicContentSize()
prepareProperties(leftControls: leftControls, rightControls: rightControls) prepareProperties(leftControls: leftControls, rightControls: rightControls)
...@@ -169,7 +169,7 @@ public class ControlView : View { ...@@ -169,7 +169,7 @@ public class ControlView : View {
contentView.grid.columns = columns contentView.grid.columns = columns
// leftControls // leftControls
if let v: Array<UIControl> = leftControls { if let v = leftControls {
for c in v { for c in v {
let w: CGFloat = c.intrinsicContentSize().width let w: CGFloat = c.intrinsicContentSize().width
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero (c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero
...@@ -189,7 +189,7 @@ public class ControlView : View { ...@@ -189,7 +189,7 @@ public class ControlView : View {
grid.views?.append(contentView) grid.views?.append(contentView)
// rightControls // rightControls
if let v: Array<UIControl> = rightControls { if let v = rightControls {
for c in v { for c in v {
let w: CGFloat = c.intrinsicContentSize().width let w: CGFloat = c.intrinsicContentSize().width
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero (c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero
...@@ -238,7 +238,7 @@ public class ControlView : View { ...@@ -238,7 +238,7 @@ public class ControlView : View {
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightControls: An Array of UIControls that go on the right side.
*/ */
internal func prepareProperties(leftControls: Array<UIControl>?, rightControls: Array<UIControl>?) { internal func prepareProperties(leftControls: [UIView]?, rightControls: [UIView]?) {
self.leftControls = leftControls self.leftControls = leftControls
self.rightControls = rightControls self.rightControls = rightControls
} }
......
...@@ -116,7 +116,7 @@ public class SearchBar : BarView { ...@@ -116,7 +116,7 @@ public class SearchBar : BarView {
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightControls: An Array of UIControls that go on the right side.
*/ */
public override init(leftControls: Array<UIControl>? = nil, rightControls: Array<UIControl>? = nil) { public override init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) {
super.init(leftControls: leftControls, rightControls: rightControls) super.init(leftControls: leftControls, rightControls: rightControls)
} }
......
...@@ -123,7 +123,7 @@ public class Toolbar : BarView { ...@@ -123,7 +123,7 @@ public class Toolbar : BarView {
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightControls: An Array of UIControls that go on the right side.
*/ */
public override init(leftControls: Array<UIControl>? = nil, rightControls: Array<UIControl>? = nil) { public override init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) {
super.init(leftControls: leftControls, rightControls: rightControls) super.init(leftControls: leftControls, rightControls: rightControls)
} }
......
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