Commit 418dc317 by Daniel Dahan

updated ControlViews to use a default expanding frame size

parent 2cd3133e
......@@ -41,9 +41,27 @@ public class BarView : ControlView {
}
}
/// A convenience initializer.
public convenience init() {
self.init(frame: CGRectZero)
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
/**
An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance
using the init() initializer.
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
super.init(frame: frame)
}
/// Basic initializer.
public override init() {
super.init()
}
/**
......@@ -51,9 +69,8 @@ public class BarView : ControlView {
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
public convenience init?(leftControls: Array<UIControl>? = nil, rightControls: Array<UIControl>? = nil) {
self.init(frame: CGRectZero)
prepareProperties(leftControls, rightControls: rightControls)
public override init(leftControls: Array<UIControl>, rightControls: Array<UIControl>) {
super.init(leftControls: leftControls, rightControls: rightControls)
}
/**
......
......@@ -118,6 +118,7 @@ public class ControlView : MaterialView {
*/
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
prepareView()
}
/**
......@@ -128,6 +129,14 @@ public class ControlView : MaterialView {
*/
public override init(frame: CGRect) {
super.init(frame: frame)
prepareView()
}
/// Basic initializer.
public init() {
super.init(frame: CGRectZero)
frame.size = intrinsicContentSize()
prepareView()
}
/**
......@@ -135,8 +144,9 @@ public class ControlView : MaterialView {
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
public convenience init?(leftControls: Array<UIControl>? = nil, rightControls: Array<UIControl>? = nil) {
self.init(frame: CGRectZero)
public init(leftControls: Array<UIControl>, rightControls: Array<UIControl>) {
super.init(frame: CGRectZero)
prepareView()
prepareProperties(leftControls, rightControls: rightControls)
}
......
......@@ -110,7 +110,7 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout {
}
public override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool {
return .Vertical == scrollDirection ? newBounds.width != collectionView!.bounds.width : newBounds.height != collectionView!.bounds.height
return .Vertical == scrollDirection ? newBounds.width != collectionView?.bounds.width : newBounds.height != collectionView?.bounds.height
}
public override func collectionViewContentSize() -> CGSize {
......
......@@ -85,11 +85,6 @@ public class SearchBar : BarView {
}
}
/// A convenience initializer.
public convenience init() {
self.init(frame: CGRectZero)
}
public override func layoutSubviews() {
super.layoutSubviews()
if willRenderView {
......@@ -99,6 +94,38 @@ public class SearchBar : BarView {
}
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
/**
An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance
using the init() initializer.
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
super.init(frame: frame)
}
/// Basic initializer.
public override init() {
super.init()
}
/**
A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
public override init(leftControls: Array<UIControl>, rightControls: Array<UIControl>) {
super.init(leftControls: leftControls, rightControls: rightControls)
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
......
......@@ -57,6 +57,38 @@ public class Toolbar : BarView {
}
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
/**
An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance
using the init() initializer.
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
super.init(frame: frame)
}
/// Basic initializer.
public override init() {
super.init()
}
/**
A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
public override init(leftControls: Array<UIControl>, rightControls: Array<UIControl>) {
super.init(leftControls: leftControls, rightControls: rightControls)
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
......
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