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
84168221
Commit
84168221
authored
Apr 03, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Storyboards detection
parent
f9468e49
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
36 deletions
+134
-36
Examples/Programmatic/TabBar/TabBar/ViewController.swift
+26
-0
README.md
+3
-0
Sources/CardView.swift
+8
-8
Sources/ControlView.swift
+3
-3
Sources/ImageCardView.swift
+8
-8
Sources/MaterialCollectionViewCell.swift
+1
-1
Sources/TabBar.swift
+85
-16
No files found.
Examples/Programmatic/TabBar/TabBar/ViewController.swift
View file @
84168221
...
...
@@ -42,6 +42,32 @@ class ViewController: UIViewController {
view
.
addSubview
(
tabBar
)
let
btn1
:
FlatButton
=
FlatButton
()
btn1
.
pulseColor
=
MaterialColor
.
white
btn1
.
pulseScale
=
false
btn1
.
setTitle
(
"ONE"
,
forState
:
.
Normal
)
btn1
.
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Normal
)
let
btn2
:
FlatButton
=
FlatButton
()
btn2
.
pulseColor
=
MaterialColor
.
white
btn2
.
pulseScale
=
false
btn2
.
setTitle
(
"TWO"
,
forState
:
.
Normal
)
btn2
.
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Normal
)
let
btn3
:
FlatButton
=
FlatButton
()
btn3
.
pulseColor
=
MaterialColor
.
white
btn3
.
pulseScale
=
false
btn3
.
setTitle
(
"THREE"
,
forState
:
.
Normal
)
btn3
.
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Normal
)
let
btn4
:
FlatButton
=
FlatButton
()
btn4
.
pulseColor
=
MaterialColor
.
white
btn4
.
pulseScale
=
false
btn4
.
setTitle
(
"FOUR"
,
forState
:
.
Normal
)
btn4
.
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Normal
)
tabBar
.
buttons
=
[
btn1
,
btn2
,
btn3
,
btn4
]
}
/// Prepares view.
...
...
README.md
View file @
84168221
...
...
@@ -365,6 +365,9 @@ Add a new dimension of interactivity with CaptureView. CaptureView is a fully fu
*
TabBarController
*
Scrolling Techniques
*
Snackbar
*
Bottom Sheets
*
Dialogs
*
Collapsing Toolbar
*
Advanced Camera / Audio Toolset & Views
*
More Examples
...
...
Sources/CardView.swift
View file @
84168221
...
...
@@ -66,7 +66,7 @@ public class CardView : MaterialPulseView {
/**
:name: dividerInset
*/
public
var
dividerInset
:
UIEdgeInsets
=
UIEdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
@IBInspectable
public
var
dividerInset
:
UIEdgeInsets
=
UIEdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
didSet
{
reloadView
()
}
...
...
@@ -84,7 +84,7 @@ public class CardView : MaterialPulseView {
/**
:name: contentInset
*/
public
var
contentInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
contentInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
...
...
@@ -102,7 +102,7 @@ public class CardView : MaterialPulseView {
/**
:name: titleLabelInset
*/
public
var
titleLabelInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
titleLabelInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
...
...
@@ -111,7 +111,7 @@ public class CardView : MaterialPulseView {
/**
:name: titleLabel
*/
public
var
titleLabel
:
UILabel
?
{
@IBInspectable
public
var
titleLabel
:
UILabel
?
{
didSet
{
titleLabel
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
...
...
@@ -130,7 +130,7 @@ public class CardView : MaterialPulseView {
/**
:name: detailViewInset
*/
public
var
detailViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
detailViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
...
...
@@ -139,7 +139,7 @@ public class CardView : MaterialPulseView {
/**
:name: detailView
*/
public
var
detailView
:
UIView
?
{
@IBInspectable
public
var
detailView
:
UIView
?
{
didSet
{
detailView
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
...
...
@@ -158,7 +158,7 @@ public class CardView : MaterialPulseView {
/**
:name: leftButtonsInset
*/
public
var
leftButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
@IBInspectable
public
var
leftButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
didSet
{
reloadView
()
}
...
...
@@ -190,7 +190,7 @@ public class CardView : MaterialPulseView {
/**
:name: rightButtonsInset
*/
public
var
rightButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
@IBInspectable
public
var
rightButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
didSet
{
reloadView
()
}
...
...
Sources/ControlView.swift
View file @
84168221
...
...
@@ -47,7 +47,7 @@ public class ControlView : MaterialView {
}
/// A wrapper around grid.contentInset.
public
var
contentInset
:
UIEdgeInsets
{
@IBInspectable
public
var
contentInset
:
UIEdgeInsets
{
get
{
return
grid
.
contentInset
}
...
...
@@ -77,7 +77,7 @@ public class ControlView : MaterialView {
public
private(set)
lazy
var
contentView
:
MaterialView
=
MaterialView
()
/// Left side UIControls.
@IBInspectable
public
var
leftControls
:
Array
<
UIControl
>
?
{
public
var
leftControls
:
Array
<
UIControl
>
?
{
didSet
{
if
let
v
:
Array
<
UIControl
>
=
oldValue
{
for
b
in
v
{
...
...
@@ -95,7 +95,7 @@ public class ControlView : MaterialView {
}
/// Right side UIControls.
@IBInspectable
public
var
rightControls
:
Array
<
UIControl
>
?
{
public
var
rightControls
:
Array
<
UIControl
>
?
{
didSet
{
if
let
v
:
Array
<
UIControl
>
=
oldValue
{
for
b
in
v
{
...
...
Sources/ImageCardView.swift
View file @
84168221
...
...
@@ -66,7 +66,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: dividerInset
*/
public
var
dividerInset
:
UIEdgeInsets
=
UIEdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
@IBInspectable
public
var
dividerInset
:
UIEdgeInsets
=
UIEdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
didSet
{
reloadView
()
}
...
...
@@ -177,7 +177,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: contentInset
*/
public
var
contentInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
contentInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
...
...
@@ -195,7 +195,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: titleLabelInset
*/
public
var
titleLabelInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
titleLabelInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
...
...
@@ -204,7 +204,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: titleLabel
*/
public
var
titleLabel
:
UILabel
?
{
@IBInspectable
public
var
titleLabel
:
UILabel
?
{
didSet
{
titleLabel
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
...
...
@@ -223,7 +223,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: detailViewInset
*/
public
var
detailViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
detailViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
...
...
@@ -232,7 +232,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: detailView
*/
public
var
detailView
:
UIView
?
{
@IBInspectable
public
var
detailView
:
UIView
?
{
didSet
{
detailView
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
...
...
@@ -251,7 +251,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: leftButtonsInset
*/
public
var
leftButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
@IBInspectable
public
var
leftButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
didSet
{
reloadView
()
}
...
...
@@ -283,7 +283,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: rightButtonsInset
*/
public
var
rightButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
@IBInspectable
public
var
rightButtonsInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
didSet
{
reloadView
()
}
...
...
Sources/MaterialCollectionViewCell.swift
View file @
84168221
...
...
@@ -142,7 +142,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
/// A wrapper around grid.contentInset.
public
var
contentInset
:
UIEdgeInsets
{
@IBInspectable
public
var
contentInset
:
UIEdgeInsets
{
get
{
return
contentView
.
grid
.
contentInset
}
...
...
Sources/TabBar.swift
View file @
84168221
...
...
@@ -30,22 +30,90 @@
import
UIKit
public
enum
TabBarLineAlignment
{
case
Top
case
Bottom
}
public
class
TabBar
:
MaterialView
{
/// A reference to the line UIView.
public
private(set)
var
line
:
UIView
!
/// A value for the line alignment.
public
var
lineAlignment
:
TabBarLineAlignment
=
.
Bottom
{
didSet
{
layoutSubviews
()
}
}
/// Will render the view.
public
var
willRenderView
:
Bool
{
return
0
<
width
}
/// Buttons.
// public var buttons: Array<UIButton>? {
// didSet {
// if let v: Array<UIButton> = oldValue {
// for b in v {
// b.removeFromSuperview()
// }
// }
//
// if let v: Array<UIControl> = leftControls {
// for b in v {
// addSubview(b)
// }
// }
// layoutSubviews()
// }
// }
public
var
buttons
:
Array
<
UIButton
>
?
{
didSet
{
if
let
v
:
Array
<
UIButton
>
=
oldValue
{
for
b
in
v
{
b
.
removeFromSuperview
()
}
}
if
let
v
:
Array
<
UIButton
>
=
buttons
{
for
b
in
v
{
addSubview
(
b
)
}
}
layoutSubviews
()
}
}
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
if
willRenderView
{
if
let
v
:
Array
<
UIButton
>
=
buttons
{
if
0
<
v
.
count
{
let
columns
:
Int
=
grid
.
axis
.
columns
/
v
.
count
for
b
in
v
{
b
.
grid
.
columns
=
columns
b
.
contentEdgeInsets
=
UIEdgeInsetsZero
b
.
layer
.
cornerRadius
=
0
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(_:)
)
,
forControlEvents
:
.
TouchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(_:)
)
,
forControlEvents
:
.
TouchUpInside
)
}
grid
.
views
=
v
as
Array
<
UIView
>
line
.
frame
=
CGRectMake
(
0
,
.
Bottom
==
lineAlignment
?
height
-
3
:
0
,
v
.
first
!.
frame
.
width
,
3
)
}
}
}
}
/// Handles the button touch event.
internal
func
handleButton
(
button
:
UIButton
)
{
UIView
.
animateWithDuration
(
0.25
,
animations
:
{
[
unowned
self
]
in
self
.
line
.
frame
.
origin
.
x
=
button
.
frame
.
origin
.
x
self
.
line
.
frame
.
size
.
width
=
button
.
frame
.
size
.
width
})
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
autoresizingMask
=
.
FlexibleWidth
prepareBottomLayer
()
}
// Prepares the bottomLayer.
private
func
prepareBottomLayer
()
{
line
=
UIView
()
line
.
backgroundColor
=
MaterialColor
.
yellow
.
base
addSubview
(
line
)
}
}
\ No newline at end of file
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