Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
65c7a1e6
Commit
65c7a1e6
authored
Dec 20, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class documents being added to MaterialView
parent
e77a0cf2
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
61 additions
and
42 deletions
+61
-42
Examples/Programmatic/CaptureView/CaptureView/ViewController.swift
+1
-1
Examples/Programmatic/CardView/CardView/ViewController.swift
+3
-3
Examples/Programmatic/ImageCardView/ImageCardView/ViewController.swift
+3
-3
Examples/Programmatic/MaterialView/MaterialView.xcodeproj/project.pbxproj
+6
-0
Examples/Programmatic/MaterialView/MaterialView/ViewController.swift
+3
-3
Examples/Programmatic/NavigationBarView/NavigationBarView/ViewController.swift
+2
-2
Examples/Storyboards/CardView/CardView/ViewController.swift
+2
-2
Examples/Storyboards/NavigationBarView/NavigationBarView/ViewController.swift
+1
-1
README.md
+5
-5
Sources/MaterialAnimation.swift
+1
-1
Sources/MaterialView.swift
+34
-21
No files found.
Examples/Programmatic/CaptureView/CaptureView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -240,7 +240,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
titleLabel
.
font
=
RobotoFont
.
regularWithSize
(
20
)
navigationBarView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
hidden
=
true
detailLabel
.
text
=
"Recording"
...
...
Examples/Programmatic/CardView/CardView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -55,7 +55,7 @@ class ViewController: UIViewController {
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
20
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
...
...
@@ -110,7 +110,7 @@ class ViewController: UIViewController {
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build beautiful software."
detailLabel
.
textColor
=
MaterialColor
.
white
...
...
@@ -157,7 +157,7 @@ class ViewController: UIViewController {
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build scalable data-driven apps."
detailLabel
.
numberOfLines
=
0
...
...
Examples/Programmatic/ImageCardView/ImageCardView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -40,8 +40,8 @@ class ViewController: UIViewController {
// Examples of using ImageCardView.
// Uncomment different examples and read
// the comments below.
prepareGeneralImageCardViewExample
()
//
prepareImageCardViewWithoutDetailLabelAndDividerExample()
//
prepareGeneralImageCardViewExample()
prepareImageCardViewWithoutDetailLabelAndDividerExample
()
}
/**
...
...
@@ -71,7 +71,7 @@ class ViewController: UIViewController {
imageCardView
.
titleLabel
=
titleLabel
imageCardView
.
titleLabelInsetsRef
.
top
=
100
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
...
...
Examples/Programmatic/MaterialView/MaterialView.xcodeproj/project.pbxproj
View file @
65c7a1e6
...
...
@@ -251,10 +251,13 @@
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CODE_SIGN_IDENTITY
=
"iPhone Developer"
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone Developer"
;
INFOPLIST_FILE
=
MaterialView/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io.cosmicmind.MaterialView
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PROVISIONING_PROFILE
=
""
;
};
name
=
Debug
;
};
...
...
@@ -262,10 +265,13 @@
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CODE_SIGN_IDENTITY
=
"iPhone Developer"
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone Developer"
;
INFOPLIST_FILE
=
MaterialView/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io.cosmicmind.MaterialView
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PROVISIONING_PROFILE
=
""
;
};
name
=
Release
;
};
...
...
Examples/Programmatic/MaterialView/MaterialView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -29,15 +29,15 @@ class ViewController: UIViewController {
}
/**
:name: prepareView
:description:
General preparation statements.
:name:
prepareView
:description:
General preparation statements.
*/
private
func
prepareView
()
{
view
.
backgroundColor
=
MaterialColor
.
white
}
/**
:name: prepareGeneralMaterialViewExample
:name:
prepareGeneralMaterialViewExample
:description: General usage example.
*/
private
func
prepareGeneralMaterialViewExample
()
{
...
...
Examples/Programmatic/NavigationBarView/NavigationBarView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -122,7 +122,7 @@ class ViewController: UIViewController {
titleLabel
.
font
=
RobotoFont
.
regularWithSize
(
20
)
navigationBarView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build Beautiful Software"
detailLabel
.
textAlignment
=
.
Center
...
...
@@ -255,7 +255,7 @@ class ViewController: UIViewController {
navigationBarView
.
titleLabel
=
titleLabel
navigationBarView
.
titleLabelInsetsRef
.
left
=
64
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build Beautiful Software"
detailLabel
.
textAlignment
=
.
Left
...
...
Examples/Storyboards/CardView/CardView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -52,7 +52,7 @@ class ViewController: UIViewController {
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
20
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
...
...
@@ -98,7 +98,7 @@ class ViewController: UIViewController {
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
secondCardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build scalable data-driven apps."
detailLabel
.
numberOfLines
=
0
...
...
Examples/Storyboards/NavigationBarView/NavigationBarView/ViewController.swift
View file @
65c7a1e6
...
...
@@ -60,7 +60,7 @@ class ViewController: UIViewController {
navigationBarView
.
titleLabel
=
titleLabel
navigationBarView
.
titleLabelInsetsRef
.
left
=
64
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build Beautiful Software"
detailLabel
.
textAlignment
=
.
Left
...
...
README.md
View file @
65c7a1e6
...
...
@@ -204,7 +204,7 @@ titleLabel.textColor = MaterialColor.blue.darken1
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
20
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
...
...
@@ -258,7 +258,7 @@ titleLabel.textColor = MaterialColor.white
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build beautiful software."
detailLabel
.
textColor
=
MaterialColor
.
white
...
...
@@ -305,7 +305,7 @@ titleLabel.text = "GraphKit"
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
24
)
cardView
.
titleLabel
=
titleLabel
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build scalable data-driven apps."
detailLabel
.
numberOfLines
=
0
...
...
@@ -402,7 +402,7 @@ titleLabel.font = RobotoFont.mediumWithSize(24)
imageCardView
.
titleLabel
=
titleLabel
imageCardView
.
titleLabelInsetsRef
.
top
=
100
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
...
...
@@ -516,7 +516,7 @@ titleLabel.font = RobotoFont.regularWithSize(20)
navigationBarView
.
titleLabel
=
titleLabel
navigationBarView
.
titleLabelInsetsRef
.
left
=
64
// Detail label
// Detail label
.
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"Build Beautiful Software"
detailLabel
.
textAlignment
=
.
Left
...
...
Sources/MaterialAnimation.swift
View file @
65c7a1e6
...
...
@@ -63,7 +63,7 @@ public struct MaterialAnimation {
var
cancelable
:
MaterialAnimationDelayCancelBlock
?
let
delayed
:
MaterialAnimationDelayCancelBlock
=
{
cancel
in
let
delayed
:
MaterialAnimationDelayCancelBlock
=
{
(
cancel
:
Bool
)
in
if
!
cancel
{
dispatch_async
(
dispatch_get_main_queue
(),
completion
)
}
...
...
Sources/MaterialView.swift
View file @
65c7a1e6
...
...
@@ -21,17 +21,23 @@ import UIKit
@objc(MaterialView)
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
()
/**
:name: delegate
A base delegate reference used when subclassing MaterialView.
*/
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
?
{
didSet
{
...
...
@@ -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
{
didSet
{
...
...
@@ -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
{
didSet
{
...
...
@@ -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
{
didSet
{
...
...
@@ -66,9 +78,7 @@ public class MaterialView : UIView {
}
}
/**
:name: contentsGravity
*/
/// Determine how content should be aligned within the visualLayer's bounds.
public
var
contentsGravity
:
MaterialGravity
{
didSet
{
visualLayer
.
contentsGravity
=
MaterialGravityToString
(
contentsGravity
)
...
...
@@ -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
{
get
{
...
...
@@ -87,18 +100,14 @@ public class MaterialView : UIView {
}
}
/**
:name: backgroundColor
*/
/// An Optional value that set's the backing layer's backgroundColor.
public
override
var
backgroundColor
:
UIColor
?
{
didSet
{
layer
.
backgroundColor
=
backgroundColor
?
.
CGColor
}
}
/**
:name: x
*/
/// A convenience property that accesses the layer.frame.origin.x property.
public
var
x
:
CGFloat
{
get
{
return
layer
.
frame
.
origin
.
x
...
...
@@ -108,9 +117,7 @@ public class MaterialView : UIView {
}
}
/**
:name: y
*/
/// A convenience property that accesses the layer.frame.origin.y property.
public
var
y
:
CGFloat
{
get
{
return
layer
.
frame
.
origin
.
y
...
...
@@ -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
{
get
{
...
...
@@ -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
{
get
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment