Commit 65c7a1e6 by Daniel Dahan

class documents being added to MaterialView

parent e77a0cf2
...@@ -240,7 +240,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg ...@@ -240,7 +240,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
titleLabel.font = RobotoFont.regularWithSize(20) titleLabel.font = RobotoFont.regularWithSize(20)
navigationBarView.titleLabel = titleLabel navigationBarView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.hidden = true detailLabel.hidden = true
detailLabel.text = "Recording" detailLabel.text = "Recording"
......
...@@ -55,7 +55,7 @@ class ViewController: UIViewController { ...@@ -55,7 +55,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.mediumWithSize(20) titleLabel.font = RobotoFont.mediumWithSize(20)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
...@@ -110,7 +110,7 @@ class ViewController: UIViewController { ...@@ -110,7 +110,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.mediumWithSize(24) titleLabel.font = RobotoFont.mediumWithSize(24)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build beautiful software." detailLabel.text = "Build beautiful software."
detailLabel.textColor = MaterialColor.white detailLabel.textColor = MaterialColor.white
...@@ -157,7 +157,7 @@ class ViewController: UIViewController { ...@@ -157,7 +157,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.mediumWithSize(24) titleLabel.font = RobotoFont.mediumWithSize(24)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build scalable data-driven apps." detailLabel.text = "Build scalable data-driven apps."
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
......
...@@ -40,8 +40,8 @@ class ViewController: UIViewController { ...@@ -40,8 +40,8 @@ class ViewController: UIViewController {
// Examples of using ImageCardView. // Examples of using ImageCardView.
// Uncomment different examples and read // Uncomment different examples and read
// the comments below. // the comments below.
prepareGeneralImageCardViewExample() // prepareGeneralImageCardViewExample()
// prepareImageCardViewWithoutDetailLabelAndDividerExample() prepareImageCardViewWithoutDetailLabelAndDividerExample()
} }
/** /**
...@@ -71,7 +71,7 @@ class ViewController: UIViewController { ...@@ -71,7 +71,7 @@ class ViewController: UIViewController {
imageCardView.titleLabel = titleLabel imageCardView.titleLabel = titleLabel
imageCardView.titleLabelInsetsRef.top = 100 imageCardView.titleLabelInsetsRef.top = 100
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
......
...@@ -251,10 +251,13 @@ ...@@ -251,10 +251,13 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = MaterialView/Info.plist; INFOPLIST_FILE = MaterialView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.MaterialView; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.MaterialView;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
}; };
name = Debug; name = Debug;
}; };
...@@ -262,10 +265,13 @@ ...@@ -262,10 +265,13 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = MaterialView/Info.plist; INFOPLIST_FILE = MaterialView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.MaterialView; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.MaterialView;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
}; };
name = Release; name = Release;
}; };
......
...@@ -29,15 +29,15 @@ class ViewController: UIViewController { ...@@ -29,15 +29,15 @@ class ViewController: UIViewController {
} }
/** /**
:name: prepareView :name: prepareView
:description: General preparation statements. :description: General preparation statements.
*/ */
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/** /**
:name: prepareGeneralMaterialViewExample :name: prepareGeneralMaterialViewExample
:description: General usage example. :description: General usage example.
*/ */
private func prepareGeneralMaterialViewExample() { private func prepareGeneralMaterialViewExample() {
......
...@@ -122,7 +122,7 @@ class ViewController: UIViewController { ...@@ -122,7 +122,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.regularWithSize(20) titleLabel.font = RobotoFont.regularWithSize(20)
navigationBarView.titleLabel = titleLabel navigationBarView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build Beautiful Software" detailLabel.text = "Build Beautiful Software"
detailLabel.textAlignment = .Center detailLabel.textAlignment = .Center
...@@ -255,7 +255,7 @@ class ViewController: UIViewController { ...@@ -255,7 +255,7 @@ class ViewController: UIViewController {
navigationBarView.titleLabel = titleLabel navigationBarView.titleLabel = titleLabel
navigationBarView.titleLabelInsetsRef.left = 64 navigationBarView.titleLabelInsetsRef.left = 64
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build Beautiful Software" detailLabel.text = "Build Beautiful Software"
detailLabel.textAlignment = .Left detailLabel.textAlignment = .Left
......
...@@ -52,7 +52,7 @@ class ViewController: UIViewController { ...@@ -52,7 +52,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.mediumWithSize(20) titleLabel.font = RobotoFont.mediumWithSize(20)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
...@@ -98,7 +98,7 @@ class ViewController: UIViewController { ...@@ -98,7 +98,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.mediumWithSize(24) titleLabel.font = RobotoFont.mediumWithSize(24)
secondCardView.titleLabel = titleLabel secondCardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build scalable data-driven apps." detailLabel.text = "Build scalable data-driven apps."
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
......
...@@ -60,7 +60,7 @@ class ViewController: UIViewController { ...@@ -60,7 +60,7 @@ class ViewController: UIViewController {
navigationBarView.titleLabel = titleLabel navigationBarView.titleLabel = titleLabel
navigationBarView.titleLabelInsetsRef.left = 64 navigationBarView.titleLabelInsetsRef.left = 64
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build Beautiful Software" detailLabel.text = "Build Beautiful Software"
detailLabel.textAlignment = .Left detailLabel.textAlignment = .Left
......
...@@ -204,7 +204,7 @@ titleLabel.textColor = MaterialColor.blue.darken1 ...@@ -204,7 +204,7 @@ titleLabel.textColor = MaterialColor.blue.darken1
titleLabel.font = RobotoFont.mediumWithSize(20) titleLabel.font = RobotoFont.mediumWithSize(20)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
...@@ -258,7 +258,7 @@ titleLabel.textColor = MaterialColor.white ...@@ -258,7 +258,7 @@ titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.mediumWithSize(24) titleLabel.font = RobotoFont.mediumWithSize(24)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build beautiful software." detailLabel.text = "Build beautiful software."
detailLabel.textColor = MaterialColor.white detailLabel.textColor = MaterialColor.white
...@@ -305,7 +305,7 @@ titleLabel.text = "GraphKit" ...@@ -305,7 +305,7 @@ titleLabel.text = "GraphKit"
titleLabel.font = RobotoFont.mediumWithSize(24) titleLabel.font = RobotoFont.mediumWithSize(24)
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build scalable data-driven apps." detailLabel.text = "Build scalable data-driven apps."
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
...@@ -402,7 +402,7 @@ titleLabel.font = RobotoFont.mediumWithSize(24) ...@@ -402,7 +402,7 @@ titleLabel.font = RobotoFont.mediumWithSize(24)
imageCardView.titleLabel = titleLabel imageCardView.titleLabel = titleLabel
imageCardView.titleLabelInsetsRef.top = 100 imageCardView.titleLabelInsetsRef.top = 100
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
...@@ -516,7 +516,7 @@ titleLabel.font = RobotoFont.regularWithSize(20) ...@@ -516,7 +516,7 @@ titleLabel.font = RobotoFont.regularWithSize(20)
navigationBarView.titleLabel = titleLabel navigationBarView.titleLabel = titleLabel
navigationBarView.titleLabelInsetsRef.left = 64 navigationBarView.titleLabelInsetsRef.left = 64
// Detail label // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build Beautiful Software" detailLabel.text = "Build Beautiful Software"
detailLabel.textAlignment = .Left detailLabel.textAlignment = .Left
......
...@@ -63,7 +63,7 @@ public struct MaterialAnimation { ...@@ -63,7 +63,7 @@ public struct MaterialAnimation {
var cancelable: MaterialAnimationDelayCancelBlock? var cancelable: MaterialAnimationDelayCancelBlock?
let delayed: MaterialAnimationDelayCancelBlock = { cancel in let delayed: MaterialAnimationDelayCancelBlock = { (cancel: Bool) in
if !cancel { if !cancel {
dispatch_async(dispatch_get_main_queue(), completion) dispatch_async(dispatch_get_main_queue(), completion)
} }
......
...@@ -21,17 +21,23 @@ import UIKit ...@@ -21,17 +21,23 @@ import UIKit
@objc(MaterialView) @objc(MaterialView)
public class MaterialView : UIView { public class MaterialView : UIView {
/** /**
:name: visualLayer A CAShapeLayer used to store an image value. Rather than
use the default layer.contents property, the visualLayer
allows for separate management of the contents. This
solves the clipsToBounds issue when supporting a shadow
and image that needs to be clipped.
*/ */
public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer() public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer()
/** /**
:name: delegate A base delegate reference used when subclassing MaterialView.
*/ */
public weak var delegate: MaterialDelegate? public weak var delegate: MaterialDelegate?
/** /**
:name: image An optional property that sets an image to the visualLayer's
contents. Images should not be set to the backing layer's
contents property to avoid conflicts when using clipsToBounds.
*/ */
public var image: UIImage? { public var image: UIImage? {
didSet { didSet {
...@@ -40,7 +46,10 @@ public class MaterialView : UIView { ...@@ -40,7 +46,10 @@ public class MaterialView : UIView {
} }
/** /**
:name: contentsRect Allows a relative subrectangle within the range of 0 to 1 to be
specified for the visualLayer's contents property. This allows
much greater flexibility than the contentsGravity property in
terms of how the image is cropped and stretched.
*/ */
public var contentsRect: CGRect { public var contentsRect: CGRect {
didSet { didSet {
...@@ -49,7 +58,8 @@ public class MaterialView : UIView { ...@@ -49,7 +58,8 @@ public class MaterialView : UIView {
} }
/** /**
:name: contentsCenter A CGRect that defines a stretchable region inside the visualLayer
with a fixed border around the edge.
*/ */
public var contentsCenter: CGRect { public var contentsCenter: CGRect {
didSet { didSet {
...@@ -58,7 +68,9 @@ public class MaterialView : UIView { ...@@ -58,7 +68,9 @@ public class MaterialView : UIView {
} }
/** /**
:name: contentsScale A floating point value that defines a ratio between the pixel dimensions
of the visualLayer's contents property and the size of the view. By default,
this value is set to the UIScreen's scale value, (UIScreen.mainScreen().scale).
*/ */
public var contentsScale: CGFloat { public var contentsScale: CGFloat {
didSet { didSet {
...@@ -66,9 +78,7 @@ public class MaterialView : UIView { ...@@ -66,9 +78,7 @@ public class MaterialView : UIView {
} }
} }
/** /// Determine how content should be aligned within the visualLayer's bounds.
:name: contentsGravity
*/
public var contentsGravity: MaterialGravity { public var contentsGravity: MaterialGravity {
didSet { didSet {
visualLayer.contentsGravity = MaterialGravityToString(contentsGravity) visualLayer.contentsGravity = MaterialGravityToString(contentsGravity)
...@@ -76,7 +86,10 @@ public class MaterialView : UIView { ...@@ -76,7 +86,10 @@ public class MaterialView : UIView {
} }
/** /**
:name: masksToBounds This property is the same as clipsToBounds. It crops any of the view's contents from
bleeding past the view's frame. If an image is set using the image property, then this
value does not need to be set, since the visualLayer's maskToBounds is set to true by
default.
*/ */
public var masksToBounds: Bool { public var masksToBounds: Bool {
get { get {
...@@ -87,18 +100,14 @@ public class MaterialView : UIView { ...@@ -87,18 +100,14 @@ public class MaterialView : UIView {
} }
} }
/** /// An Optional value that set's the backing layer's backgroundColor.
:name: backgroundColor
*/
public override var backgroundColor: UIColor? { public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/** /// A convenience property that accesses the layer.frame.origin.x property.
:name: x
*/
public var x: CGFloat { public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
...@@ -108,9 +117,7 @@ public class MaterialView : UIView { ...@@ -108,9 +117,7 @@ public class MaterialView : UIView {
} }
} }
/** /// A convenience property that accesses the layer.frame.origin.y property.
:name: y
*/
public var y: CGFloat { public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
...@@ -121,7 +128,10 @@ public class MaterialView : UIView { ...@@ -121,7 +128,10 @@ public class MaterialView : UIView {
} }
/** /**
:name: width A convenience property that accesses the layer.frame.origin.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
*/ */
public var width: CGFloat { public var width: CGFloat {
get { get {
...@@ -136,7 +146,10 @@ public class MaterialView : UIView { ...@@ -136,7 +146,10 @@ public class MaterialView : UIView {
} }
/** /**
:name: height A convenience property that accesses the layer.frame.origin.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
*/ */
public var height: CGFloat { public var height: CGFloat {
get { get {
......
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