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
cbae939a
Unverified
Commit
cbae939a
authored
Jun 11, 2016
by
M. Porooshani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked the Layout class for chainables and did some cleanup
parent
2b3fa494
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23 additions
and
18 deletions
+23
-18
Examples/Programmatic/App/App/AppLeftViewController.swift
+5
-3
Examples/Programmatic/App/App/AppMenuController.swift
+1
-1
Examples/Programmatic/App/App/RecipesViewController.swift
+2
-2
Examples/Programmatic/App/App/RecommendationViewController.swift
+2
-2
Examples/Programmatic/Layout/Layout/ViewController.swift
+6
-3
Sources/iOS/BottomTabBar.swift
+1
-1
Sources/iOS/CardView.swift
+2
-2
Sources/iOS/ImageCardView.swift
+3
-3
Sources/iOS/Layout.swift
+0
-0
Sources/iOS/TextView.swift
+1
-1
No files found.
Examples/Programmatic/App/App/AppLeftViewController.swift
View file @
cbae939a
...
@@ -97,10 +97,12 @@ class AppLeftViewController: UIViewController {
...
@@ -97,10 +97,12 @@ class AppLeftViewController: UIViewController {
nameLabel
.
font
=
RobotoFont
.
mediumWithSize
(
18
)
nameLabel
.
font
=
RobotoFont
.
mediumWithSize
(
18
)
view
.
layout
.
size
(
profileView
,
width
:
72
,
height
:
72
)
view
.
layout
.
size
(
profileView
,
width
:
72
,
height
:
72
)
view
.
layout
.
align
.
topLeft
(
profileView
,
top
:
30
,
left
:
(
view
.
bounds
.
width
-
72
)
/
2
)
// view.layout.align.topLeft(profileView, top: 30, left: (view.bounds.width - 72) / 2)
view
.
layout
(
profileView
)
.
top
(
30
)
.
left
((
view
.
bounds
.
width
-
72
)
/
2
)
view
.
addSubview
(
nameLabel
)
view
.
addSubview
(
nameLabel
)
view
.
layout
.
align
Layout
.
alignFromTop
(
view
,
child
:
nameLabel
,
top
:
130
)
Layout
.
alignFromTop
(
view
,
child
:
nameLabel
,
top
:
130
)
Layout
.
alignToParentHorizontally
(
view
,
child
:
nameLabel
,
left
:
20
,
right
:
20
)
Layout
.
alignToParentHorizontally
(
view
,
child
:
nameLabel
,
left
:
20
,
right
:
20
)
// view.layout.alignFromTop(nameLabel, top: 130)
// view.layout.alignFromTop(nameLabel, top: 130)
...
@@ -116,7 +118,7 @@ class AppLeftViewController: UIViewController {
...
@@ -116,7 +118,7 @@ class AppLeftViewController: UIViewController {
tableView
.
separatorStyle
=
.
None
tableView
.
separatorStyle
=
.
None
// Use Layout to easily align the tableView.
// Use Layout to easily align the tableView.
view
.
layout
.
align
.
edges
(
tableView
,
top
:
170
)
view
.
layout
.
edges
(
tableView
,
top
:
170
)
}
}
}
}
...
...
Examples/Programmatic/App/App/AppMenuController.swift
View file @
cbae939a
...
@@ -157,7 +157,7 @@ class AppMenuController: MenuController {
...
@@ -157,7 +157,7 @@ class AppMenuController: MenuController {
menuView
.
delegate
=
self
menuView
.
delegate
=
self
view
.
layout
.
size
(
menuView
,
width
:
baseSize
.
width
,
height
:
baseSize
.
height
)
view
.
layout
.
size
(
menuView
,
width
:
baseSize
.
width
,
height
:
baseSize
.
height
)
view
.
layout
.
align
.
bottomRight
(
menuView
,
bottom
:
menuViewInset
,
right
:
menuViewInset
)
view
.
layout
.
bottomRight
(
menuView
,
bottom
:
menuViewInset
,
right
:
menuViewInset
)
}
}
/// Prepare tabBarItem.
/// Prepare tabBarItem.
...
...
Examples/Programmatic/App/App/RecipesViewController.swift
View file @
cbae939a
...
@@ -169,7 +169,7 @@ class RecipesViewController: UIViewController {
...
@@ -169,7 +169,7 @@ class RecipesViewController: UIViewController {
tableView
.
delegate
=
self
tableView
.
delegate
=
self
// Use Layout to easily align the tableView.
// Use Layout to easily align the tableView.
view
.
layout
.
align
.
edges
(
tableView
)
view
.
layout
.
edges
(
tableView
)
}
}
}
}
...
@@ -214,7 +214,7 @@ extension RecipesViewController: UITableViewDataSource {
...
@@ -214,7 +214,7 @@ extension RecipesViewController: UITableViewDataSource {
label
.
textColor
=
MaterialColor
.
grey
.
darken1
label
.
textColor
=
MaterialColor
.
grey
.
darken1
label
.
text
=
"Favorites"
label
.
text
=
"Favorites"
header
.
layout
.
align
.
edges
(
label
,
left
:
24
)
header
.
layout
.
edges
(
label
,
left
:
24
)
return
header
return
header
}
}
...
...
Examples/Programmatic/App/App/RecommendationViewController.swift
View file @
cbae939a
...
@@ -70,7 +70,7 @@ class RecommendationViewController: UIViewController {
...
@@ -70,7 +70,7 @@ class RecommendationViewController: UIViewController {
tableView
.
delegate
=
self
tableView
.
delegate
=
self
// Use Layout to easily align the tableView.
// Use Layout to easily align the tableView.
view
.
layout
.
align
.
edges
(
tableView
)
view
.
layout
.
edges
(
tableView
)
}
}
}
}
...
@@ -115,7 +115,7 @@ extension RecommendationViewController: UITableViewDataSource {
...
@@ -115,7 +115,7 @@ extension RecommendationViewController: UITableViewDataSource {
label
.
textColor
=
MaterialColor
.
grey
.
darken1
label
.
textColor
=
MaterialColor
.
grey
.
darken1
label
.
text
=
"Recommendations"
label
.
text
=
"Recommendations"
header
.
layout
.
align
.
edges
(
label
,
left
:
24
)
header
.
layout
.
edges
(
label
,
left
:
24
)
return
header
return
header
}
}
...
...
Examples/Programmatic/Layout/Layout/ViewController.swift
View file @
cbae939a
...
@@ -41,7 +41,7 @@ class ViewController: UIViewController {
...
@@ -41,7 +41,7 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
prepareView
()
prepareView
()
//
prepareAlignToParentHorizontallyAndVerticallyExample()
prepareAlignToParentHorizontallyAndVerticallyExample
()
prepareCenterExample
()
prepareCenterExample
()
}
}
...
@@ -75,10 +75,13 @@ class ViewController: UIViewController {
...
@@ -75,10 +75,13 @@ class ViewController: UIViewController {
let
children
:
Array
<
UIView
>
=
[
label1
,
label2
,
label3
,
label4
]
let
children
:
Array
<
UIView
>
=
[
label1
,
label2
,
label3
,
label4
]
// Align the labels vertically with an equal height.
// Align the labels vertically with an equal height.
view
.
layout
.
vertically
(
children
,
top
:
100
,
bottom
:
100
)
//
view.layout.vertically(children, top: 100, bottom: 100)
// Align the labels horizontally with an equal width.
// Align the labels horizontally with an equal width.
view
.
layout
.
horizontally
(
children
,
left
:
30
,
right
:
30
,
spacing
:
30
)
// view.layout.horizontally(children, left: 30, right: 30, spacing: 30)
view
.
layout
.
horizontally
(
children
,
left
:
30
,
right
:
30
,
spacing
:
30
)
.
vertically
(
children
,
top
:
100
,
bottom
:
100
)
// Print out the dimensions of the labels.
// Print out the dimensions of the labels.
for
v
in
children
{
for
v
in
children
{
...
...
Sources/iOS/BottomTabBar.swift
View file @
cbae939a
...
@@ -233,7 +233,7 @@ public class BottomTabBar : UITabBar {
...
@@ -233,7 +233,7 @@ public class BottomTabBar : UITabBar {
super
.
didMoveToSuperview
()
super
.
didMoveToSuperview
()
if
autoLayoutToSuperview
{
if
autoLayoutToSuperview
{
if
let
v
:
UIView
=
superview
{
if
let
v
:
UIView
=
superview
{
v
.
layout
.
align
.
bottom
(
self
)
v
.
layout
(
self
)
.
bottom
(
)
v
.
layout
.
horizontally
(
self
)
v
.
layout
.
horizontally
(
self
)
}
}
}
}
...
...
Sources/iOS/CardView.swift
View file @
cbae939a
...
@@ -314,7 +314,7 @@ public class CardView : MaterialPulseView {
...
@@ -314,7 +314,7 @@ public class CardView : MaterialPulseView {
h
+=
"[
\(
k
)
]"
h
+=
"[
\(
k
)
]"
layout
.
align
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
leftButtonsInset
.
bottom
)
layout
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
leftButtonsInset
.
bottom
)
i
+=
1
i
+=
1
}
}
...
@@ -343,7 +343,7 @@ public class CardView : MaterialPulseView {
...
@@ -343,7 +343,7 @@ public class CardView : MaterialPulseView {
h
+=
"-(right_left)-"
h
+=
"-(right_left)-"
}
}
layout
.
align
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
rightButtonsInset
.
bottom
)
layout
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
rightButtonsInset
.
bottom
)
i
-=
1
i
-=
1
}
}
...
...
Sources/iOS/ImageCardView.swift
View file @
cbae939a
...
@@ -378,7 +378,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -378,7 +378,7 @@ public class ImageCardView : MaterialPulseView {
verticalFormat
+=
"-[titleLabel]"
verticalFormat
+=
"-[titleLabel]"
views
[
"titleLabel"
]
=
v
views
[
"titleLabel"
]
=
v
}
else
{
}
else
{
layout
.
align
.
top
(
v
,
top
:
contentInset
.
top
+
titleLabelInset
.
top
)
layout
.
top
(
v
,
top
:
contentInset
.
top
+
titleLabelInset
.
top
)
}
}
layout
.
horizontally
(
v
,
left
:
contentInset
.
left
+
titleLabelInset
.
left
,
right
:
contentInset
.
right
+
titleLabelInset
.
right
)
layout
.
horizontally
(
v
,
left
:
contentInset
.
left
+
titleLabelInset
.
left
,
right
:
contentInset
.
right
+
titleLabelInset
.
right
)
}
}
...
@@ -417,7 +417,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -417,7 +417,7 @@ public class ImageCardView : MaterialPulseView {
h
+=
"[
\(
k
)
]"
h
+=
"[
\(
k
)
]"
layout
.
align
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
leftButtonsInset
.
bottom
)
layout
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
leftButtonsInset
.
bottom
)
i
+=
1
i
+=
1
}
}
...
@@ -446,7 +446,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -446,7 +446,7 @@ public class ImageCardView : MaterialPulseView {
h
+=
"-(right_left)-"
h
+=
"-(right_left)-"
}
}
layout
.
align
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
rightButtonsInset
.
bottom
)
layout
.
bottom
(
b
,
bottom
:
contentInset
.
bottom
+
rightButtonsInset
.
bottom
)
i
-=
1
i
-=
1
}
}
...
...
Sources/iOS/Layout.swift
View file @
cbae939a
This diff is collapsed.
Click to expand it.
Sources/iOS/TextView.swift
View file @
cbae939a
...
@@ -401,7 +401,7 @@ public class TextView: UITextView {
...
@@ -401,7 +401,7 @@ public class TextView: UITextView {
internal
func
reloadView
()
{
internal
func
reloadView
()
{
if
let
p
=
placeholderLabel
{
if
let
p
=
placeholderLabel
{
removeConstraints
(
constraints
)
removeConstraints
(
constraints
)
layout
.
align
.
edges
(
p
,
layout
.
edges
(
p
,
top
:
textContainerInset
.
top
,
top
:
textContainerInset
.
top
,
left
:
textContainerInset
.
left
+
textContainer
.
lineFragmentPadding
,
left
:
textContainerInset
.
left
+
textContainer
.
lineFragmentPadding
,
bottom
:
textContainerInset
.
bottom
,
bottom
:
textContainerInset
.
bottom
,
...
...
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