Commit 2bfceb08 by Daniel Dahan

prepare for release 1.24.4

parent 8d81d569
...@@ -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 */; };
966F57B31C226CA3009185B7 /* MaterialKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 966F57B21C226CA3009185B7 /* MaterialKit.framework */; };
966F57B41C226CA3009185B7 /* MaterialKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 966F57B21C226CA3009185B7 /* MaterialKit.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 = (
966F57B41C226CA3009185B7 /* MaterialKit.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>"; };
966F57B21C226CA3009185B7 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = MaterialKit.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/MaterialKit-anypxbsecgdqqxevbavirvnffqxd/Build/Products/Debug-iphoneos/MaterialKit.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 = (
966F57B31C226CA3009185B7 /* MaterialKit.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
966F57941C226BAA009185B7 = { 966F57941C226BAA009185B7 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
966F57B21C226CA3009185B7 /* MaterialKit.framework */,
966F579F1C226BAA009185B7 /* TextField */, 966F579F1C226BAA009185B7 /* TextField */,
966F579E1C226BAA009185B7 /* Products */, 966F579E1C226BAA009185B7 /* Products */,
); );
......
...@@ -20,13 +20,15 @@ import UIKit ...@@ -20,13 +20,15 @@ import UIKit
import MaterialKit import MaterialKit
class ViewController: UIViewController, TextFieldDelegate { class ViewController: UIViewController, TextFieldDelegate {
private lazy var titleTextField: TextField = TextField() private lazy var titleField: TextField = TextField()
private lazy var descriptionField: TextField = TextField()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareTitleTextField() prepareTitleField()
prepareDescriptionField()
} }
/** /**
...@@ -37,20 +39,37 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -37,20 +39,37 @@ class ViewController: UIViewController, TextFieldDelegate {
} }
/** /**
:name: prepareTitleTextField :name: prepareTitleField
:description: A preparation helper method for titleTextField. :description: A preparation helper for titleField.
*/ */
private func prepareTitleTextField() { private func prepareTitleField() {
titleTextField.frame = CGRectMake(100, 100, 200, 35) titleField.delegate = self
titleTextField.placeholder = "Title" titleField.frame = CGRectMake(57, 100, 300, 24)
titleTextField.textColor = MaterialColor.black titleField.placeholder = "Title"
titleTextField.titleLabel = UILabel() titleField.font = RobotoFont.regularWithSize(20)
titleTextField.titleLabel!.font = RobotoFont.boldWithSize(12) titleField.textColor = MaterialColor.black
titleTextField.font = RobotoFont.boldWithSize(24) titleField.titleLabel = UILabel()
titleTextField.delegate = self titleField.titleLabel!.font = RobotoFont.mediumWithSize(12)
titleTextField.titleNormalColor = MaterialColor.grey.lighten1 titleField.titleLabelNormalColor = MaterialColor.grey.lighten1
titleTextField.titleHighlightedColor = MaterialColor.blue.accent3 titleField.titleLabelHighlightedColor = MaterialColor.blue.accent3
view.addSubview(titleTextField) view.addSubview(titleField)
}
/**
:name: prepareDescriptionField
:description: A preparation helper for descriptionField.
*/
private func prepareDescriptionField() {
descriptionField.delegate = self
descriptionField.frame = CGRectMake(57, 150, 300, 24)
descriptionField.placeholder = "Description"
descriptionField.font = RobotoFont.regularWithSize(20)
descriptionField.textColor = MaterialColor.black
descriptionField.titleLabel = UILabel()
descriptionField.titleLabel!.font = RobotoFont.mediumWithSize(12)
descriptionField.titleLabelNormalColor = MaterialColor.grey.lighten1
descriptionField.titleLabelHighlightedColor = MaterialColor.blue.accent3
view.addSubview(descriptionField)
} }
/** /**
...@@ -59,9 +78,7 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -59,9 +78,7 @@ class ViewController: UIViewController, TextFieldDelegate {
key on the keyboard. key on the keyboard.
*/ */
func textFieldShouldReturn(textField: UITextField) -> Bool { func textFieldShouldReturn(textField: UITextField) -> Bool {
if textField == titleTextField { textField.resignFirstResponder()
titleTextField.resignFirstResponder()
}
return false return false
} }
......
...@@ -28,6 +28,7 @@ Run carthage to build the framework and drag the built MaterialKit.framework int ...@@ -28,6 +28,7 @@ Run carthage to build the framework and drag the built MaterialKit.framework int
### Table of Contents ### Table of Contents
* [TextView](#textview)
* [MaterialColor](#materialcolor) * [MaterialColor](#materialcolor)
* [MaterialLayer](#materiallayer) * [MaterialLayer](#materiallayer)
* [MaterialView](#materialview) * [MaterialView](#materialview)
...@@ -43,14 +44,23 @@ Run carthage to build the framework and drag the built MaterialKit.framework int ...@@ -43,14 +44,23 @@ Run carthage to build the framework and drag the built MaterialKit.framework int
### Upcoming ### Upcoming
* Scrolling Techniques
* TextField
* SearchBarView * SearchBarView
* SearchBarViewController * SearchBarViewController
* TabView * TabView
* TabViewController * TabViewController
* TextView
* Scrolling Techniques
* More Examples * More Examples
<a name="textview"/>
### TextField
A TextField is a great option to increase UX. Below is an example.
Space on mobile devices
![MaterialKitTextField](http://www.materialkit.io/MK/MaterialKitTextField.gif)
<a name="materialcolor"/> <a name="materialcolor"/>
### MaterialColor ### MaterialColor
......
...@@ -27,23 +27,18 @@ public class TextField : UITextField { ...@@ -27,23 +27,18 @@ public class TextField : UITextField {
private var count: Int? private var count: Int?
/** /**
:name: titleNormalColor :name: titleLabelNormalColor
*/ */
public var titleNormalColor: UIColor? { public var titleLabelNormalColor: UIColor? {
didSet { didSet {
titleLabel?.textColor = titleNormalColor titleLabel?.textColor = titleLabelNormalColor
} }
} }
/** /**
:name: titleHighlightedColor :name: titleLabelHighlightedColor
*/ */
public var titleHighlightedColor: UIColor? public var titleLabelHighlightedColor: UIColor?
/**
:name: bottomBorderLayer
*/
public private(set) lazy var bottomBorderLayer: MaterialLayer = MaterialLayer()
/** /**
:name: titleLabel :name: titleLabel
...@@ -83,19 +78,10 @@ public class TextField : UITextField { ...@@ -83,19 +78,10 @@ public class TextField : UITextField {
} }
/** /**
:name: layoutSubviews
*/
public override func layoutSubviews() {
super.layoutSubviews()
bottomBorderLayer.frame = CGRectMake(0, bounds.height - bottomBorderLayer.height, bounds.width, bottomBorderLayer.height)
}
/**
:name: prepareView :name: prepareView
*/ */
public func prepareView() { public func prepareView() {
clipsToBounds = false clipsToBounds = false
prepareBottomBorderLayer()
} }
/** /**
...@@ -103,7 +89,7 @@ public class TextField : UITextField { ...@@ -103,7 +89,7 @@ public class TextField : UITextField {
*/ */
internal func textFieldDidBegin(textField: TextField) { internal func textFieldDidBegin(textField: TextField) {
count = text?.utf16.count count = text?.utf16.count
titleLabel?.textColor = titleHighlightedColor titleLabel?.textColor = 0 == count ? titleLabelNormalColor : titleLabelHighlightedColor
} }
/** /**
...@@ -112,17 +98,18 @@ public class TextField : UITextField { ...@@ -112,17 +98,18 @@ public class TextField : UITextField {
internal func textFieldDidChange(textField: TextField) { internal func textFieldDidChange(textField: TextField) {
if 0 == count && 1 == text?.utf16.count { if 0 == count && 1 == text?.utf16.count {
if let v: UILabel = titleLabel { if let v: UILabel = titleLabel {
UIView.animateWithDuration(0.25, animations: {
v.hidden = false v.hidden = false
UIView.animateWithDuration(0.25, animations: {
v.alpha = 1 v.alpha = 1
v.frame.origin.y = -v.frame.height v.frame.origin.y = -v.frame.height
}) })
titleLabel?.textColor = titleLabelHighlightedColor
} }
} else if 1 == count && 0 == text?.utf16.count { } else if 1 == count && 0 == text?.utf16.count {
if let v: UILabel = titleLabel { if let v: UILabel = titleLabel {
UIView.animateWithDuration(0.25, animations: { UIView.animateWithDuration(0.25, animations: {
v.alpha = 0 v.alpha = 0
v.frame.origin.y = -v.frame.height / 3 v.frame.origin.y = -v.frame.height + 4
}) { _ in }) { _ in
v.hidden = true v.hidden = true
} }
...@@ -137,8 +124,8 @@ public class TextField : UITextField { ...@@ -137,8 +124,8 @@ public class TextField : UITextField {
internal func textFieldDidEnd(textField: TextField) { internal func textFieldDidEnd(textField: TextField) {
if 0 < count { if 0 < count {
if let v: UILabel = titleLabel { if let v: UILabel = titleLabel {
UIView.animateWithDuration(0.25, animations: {
v.hidden = false v.hidden = false
UIView.animateWithDuration(0.25, animations: {
v.alpha = 1 v.alpha = 1
v.frame.origin.y = -v.frame.height v.frame.origin.y = -v.frame.height
}) })
...@@ -147,22 +134,13 @@ public class TextField : UITextField { ...@@ -147,22 +134,13 @@ public class TextField : UITextField {
if let v: UILabel = titleLabel { if let v: UILabel = titleLabel {
UIView.animateWithDuration(0.25, animations: { UIView.animateWithDuration(0.25, animations: {
v.alpha = 0 v.alpha = 0
v.frame.origin.y = -v.frame.height / 3 v.frame.origin.y = -v.frame.height + 4
}) { _ in }) { _ in
v.hidden = true v.hidden = true
} }
} }
} }
titleLabel?.textColor = titleNormalColor titleLabel?.textColor = titleLabelNormalColor
}
/**
:name: prepareBottomBorderLayer
*/
private func prepareBottomBorderLayer() {
bottomBorderLayer.frame = CGRectMake(0, bounds.height + 5, bounds.width, 3)
bottomBorderLayer.backgroundColor = MaterialColor.grey.lighten3.CGColor
layer.addSublayer(bottomBorderLayer)
} }
/** /**
......
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