Commit 3bf5457b by Daniel Dahan

updates to establish a clean environment

parent b1c2ce77
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
966F57A31C226BAA009185B7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A21C226BAA009185B7 /* ViewController.swift */; }; 966F57A31C226BAA009185B7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A21C226BAA009185B7 /* ViewController.swift */; };
966F57A81C226BAA009185B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A71C226BAA009185B7 /* Assets.xcassets */; }; 966F57A81C226BAA009185B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A71C226BAA009185B7 /* Assets.xcassets */; };
966F57AB1C226BAA009185B7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A91C226BAA009185B7 /* LaunchScreen.storyboard */; }; 966F57AB1C226BAA009185B7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A91C226BAA009185B7 /* LaunchScreen.storyboard */; };
96977E271CBE9CC4000BEFC4 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96977E261CBE9CC4000BEFC4 /* Material.framework */; };
96977E281CBE9CC4000BEFC4 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96977E261CBE9CC4000BEFC4 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96977E281CBE9CC4000BEFC4 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -36,7 +33,6 @@ ...@@ -36,7 +33,6 @@
966F57A71C226BAA009185B7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 966F57A71C226BAA009185B7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
966F57AA1C226BAA009185B7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 966F57AA1C226BAA009185B7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
966F57AC1C226BAA009185B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 966F57AC1C226BAA009185B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96977E261CBE9CC4000BEFC4 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96977E271CBE9CC4000BEFC4 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
966F57941C226BAA009185B7 = { 966F57941C226BAA009185B7 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96977E261CBE9CC4000BEFC4 /* Material.framework */,
966F579F1C226BAA009185B7 /* TextField */, 966F579F1C226BAA009185B7 /* TextField */,
966F579E1C226BAA009185B7 /* Products */, 966F579E1C226BAA009185B7 /* Products */,
); );
......
...@@ -65,8 +65,8 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -65,8 +65,8 @@ class ViewController: UIViewController, TextFieldDelegate {
let w: CGFloat = 300 let w: CGFloat = 300
let x: CGFloat = (MaterialDevice.width - w) / 2 let x: CGFloat = (MaterialDevice.width - w) / 2
let textField: TextField = TextField(frame: CGRectMake(x, 200, w, 24)) let textField: TextField = TextField(frame: CGRectMake(x, 200, w, 24))
textField.delegate = self
textField.placeholder = "Email" textField.placeholder = "Email"
textField.delegate = self
/* /*
Used to display the error message, which is displayed when Used to display the error message, which is displayed when
...@@ -76,10 +76,6 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -76,10 +76,6 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.detailLabel!.text = "Email is incorrect." textField.detailLabel!.text = "Email is incorrect."
textField.detailLabel!.font = RobotoFont.regularWithSize(12) textField.detailLabel!.font = RobotoFont.regularWithSize(12)
textField.detailLabelActiveColor = MaterialColor.red.accent3 textField.detailLabelActiveColor = MaterialColor.red.accent3
textField.lineLayerThickness = 3
textField.lineLayerActiveThickness = 5
// textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding. // textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
view.addSubview(textField) view.addSubview(textField)
......
...@@ -61,8 +61,8 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -61,8 +61,8 @@ class ViewController: UIViewController, TextFieldDelegate {
/// Prepares the email TextField. /// Prepares the email TextField.
private func prepareEmailField() { private func prepareEmailField() {
emailField.delegate = self
emailField.placeholder = "Email" emailField.placeholder = "Email"
emailField.delegate = self
/* /*
Used to display the error message, which is displayed when Used to display the error message, which is displayed when
......
...@@ -339,7 +339,6 @@ public class MaterialButton : UIButton { ...@@ -339,7 +339,6 @@ public class MaterialButton : UIButton {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
} }
/// Overriding the layout callback for sublayers.
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
......
...@@ -444,7 +444,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -444,7 +444,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
} }
/// Overriding the layout callback for sublayers.
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
......
...@@ -295,7 +295,6 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -295,7 +295,6 @@ public class MaterialTableViewCell : UITableViewCell {
prepareView() prepareView()
} }
/// Overriding the layout callback for sublayers.
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
......
...@@ -303,7 +303,6 @@ public class MaterialTextView: UITextView { ...@@ -303,7 +303,6 @@ public class MaterialTextView: UITextView {
removeNotificationHandlers() removeNotificationHandlers()
} }
/// Overriding the layout callback for sublayers.
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
......
...@@ -386,7 +386,6 @@ public class MaterialView : UIView { ...@@ -386,7 +386,6 @@ public class MaterialView : UIView {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
} }
/// Overriding the layout callback for sublayers.
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
......
...@@ -95,17 +95,10 @@ public class SearchBar : StatusBarView { ...@@ -95,17 +95,10 @@ public class SearchBar : StatusBarView {
if willRenderView { if willRenderView {
contentView.grid.views?.append(textField) contentView.grid.views?.append(textField)
contentView.grid.reloadLayout() contentView.grid.reloadLayout()
reloadView() layoutClearButton()
} }
} }
/// Reloads the view.
public func reloadView() {
/// Align the clearButton.
let h: CGFloat = textField.frame.height
clearButton.frame = CGRectMake(textField.frame.width - h, 0, h, h)
}
/// Prepares the contentView. /// Prepares the contentView.
public override func prepareContentView() { public override func prepareContentView() {
super.prepareContentView() super.prepareContentView()
...@@ -146,4 +139,10 @@ public class SearchBar : StatusBarView { ...@@ -146,4 +139,10 @@ public class SearchBar : StatusBarView {
textField.rightViewMode = .WhileEditing textField.rightViewMode = .WhileEditing
textField.rightView = clearButton textField.rightView = clearButton
} }
/// Layout the clearButton.
private func layoutClearButton() {
let h: CGFloat = textField.frame.height
clearButton.frame = CGRectMake(textField.frame.width - h, 0, h, h)
}
} }
...@@ -358,9 +358,7 @@ public class TextField : UITextField { ...@@ -358,9 +358,7 @@ public class TextField : UITextField {
*/ */
@IBInspectable public var detailLabelAutoHideEnabled: Bool = true @IBInspectable public var detailLabelAutoHideEnabled: Bool = true
/** /// A boolean that indicates to hide or not hide the detailLabel.
:name: detailLabelHidden
*/
@IBInspectable public var detailLabelHidden: Bool = true { @IBInspectable public var detailLabelHidden: Bool = true {
didSet { didSet {
if detailLabelHidden { if detailLabelHidden {
...@@ -418,7 +416,11 @@ public class TextField : UITextField { ...@@ -418,7 +416,11 @@ public class TextField : UITextField {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
} }
/// Overriding the layout callback for sublayers. public override func layoutSubviews() {
super.layoutSubviews()
layoutClearButton()
}
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
...@@ -489,34 +491,25 @@ public class TextField : UITextField { ...@@ -489,34 +491,25 @@ public class TextField : UITextField {
when subclassing. when subclassing.
*/ */
public func prepareView() { public func prepareView() {
backgroundColor = MaterialColor.white
masksToBounds = false masksToBounds = false
font = RobotoFont.regularWithSize(16) backgroundColor = MaterialColor.white
textColor = MaterialColor.darkText.primary textColor = MaterialColor.darkText.primary
borderStyle = .None font = RobotoFont.regularWithSize(16)
prepareClearButton() prepareClearButton()
prepareTitleLabel() prepareTitleLabel()
prepareLineLayer() prepareLineLayer()
reloadView()
addTarget(self, action: #selector(textFieldDidBegin), forControlEvents: .EditingDidBegin) addTarget(self, action: #selector(textFieldDidBegin), forControlEvents: .EditingDidBegin)
addTarget(self, action: #selector(textFieldDidChange), forControlEvents: .EditingChanged) addTarget(self, action: #selector(textFieldDidChange), forControlEvents: .EditingChanged)
addTarget(self, action: #selector(textFieldDidEnd), forControlEvents: .EditingDidEnd) addTarget(self, action: #selector(textFieldDidEnd), forControlEvents: .EditingDidEnd)
addTarget(self, action: #selector(textFieldValueChanged), forControlEvents: .ValueChanged) addTarget(self, action: #selector(textFieldValueChanged), forControlEvents: .ValueChanged)
} }
/// Reloads the view.
public func reloadView() {
// clearButton.frame = CGRectMake(width - height, 0, height, height)
}
/// Clears the textField text. /// Clears the textField text.
internal func handleClearButton() { internal func handleClearButton() {
if false == delegate?.textFieldShouldClear?(self) { if false == delegate?.textFieldShouldClear?(self) {
return return
} }
text = "" text = ""
sendActionsForControlEvents(.ValueChanged)
} }
/// Ahdnler when text value changed. /// Ahdnler when text value changed.
...@@ -624,6 +617,13 @@ public class TextField : UITextField { ...@@ -624,6 +617,13 @@ public class TextField : UITextField {
rightView = clearButton rightView = clearButton
} }
/// Layout the clearButton.
private func layoutClearButton() {
if 0 < width && 0 < height {
clearButton.frame = CGRectMake(width - height, 0, height, height)
}
}
/// Shows and animates the titleLabel property. /// Shows and animates the titleLabel property.
private func showTitleLabel() { private func showTitleLabel() {
if titleLabel.hidden { if titleLabel.hidden {
......
...@@ -145,7 +145,6 @@ public class TextView: MaterialView { ...@@ -145,7 +145,6 @@ public class TextView: MaterialView {
super.init(frame: CGRectNull) super.init(frame: CGRectNull)
} }
/// Overriding the layout callback for sublayers.
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
......
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