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
8db29285
Commit
8db29285
authored
Feb 11, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated project to Grid from GridView
parent
50d1b21d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
69 additions
and
46 deletions
+69
-46
Examples/Material.xcworkspace/contents.xcworkspacedata
+7
-7
Examples/Programmatic/Grid/Grid.xcodeproj/project.pbxproj
+0
-0
Examples/Programmatic/Grid/Grid.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+1
-1
Examples/Programmatic/Grid/Grid/AppDelegate.swift
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-29.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@2x-1.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-40.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@2x-1.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-60@2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-60@3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-76.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-76@2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/AppIcon.appiconset/Material-Icon-83.5@2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/CosmicMindInverted.imageset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/CosmicMindInverted.imageset/CosmicMindInverted.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_alarm_white.imageset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white_2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white_3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_auto_white.imageset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white_2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white_3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_off_white.imageset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white_2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white_3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_on_white.imageset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white_2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white_3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_more_vert_white.imageset/Contents.json
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white_2x.png
+0
-0
Examples/Programmatic/Grid/Grid/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white_3x.png
+0
-0
Examples/Programmatic/Grid/Grid/Base.lproj/LaunchScreen.storyboard
+0
-0
Examples/Programmatic/Grid/Grid/Info.plist
+0
-2
Examples/Programmatic/Grid/Grid/ViewController.swift
+12
-10
Sources/Grid.swift
+49
-26
No files found.
Examples/Material.xcworkspace/contents.xcworkspacedata
View file @
8db29285
...
@@ -16,6 +16,13 @@
...
@@ -16,6 +16,13 @@
</Group>
</Group>
<Group
<Group
location =
"container:"
location =
"container:"
name =
"Grid"
>
<FileRef
location =
"group:Programmatic/Grid/Grid.xcodeproj"
>
</FileRef>
</Group>
<Group
location =
"container:"
name =
"MaterialLayer"
>
name =
"MaterialLayer"
>
<FileRef
<FileRef
location =
"group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj"
>
location =
"group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj"
>
...
@@ -98,13 +105,6 @@
...
@@ -98,13 +105,6 @@
location =
"group:Programmatic/CaptureView/CaptureView.xcodeproj"
>
location =
"group:Programmatic/CaptureView/CaptureView.xcodeproj"
>
</FileRef>
</FileRef>
</Group>
</Group>
<Group
location =
"container:"
name =
"GridView"
>
<FileRef
location =
"group:Programmatic/GridView/GridView.xcodeproj"
>
</FileRef>
</Group>
</Group>
</Group>
<Group
<Group
location =
"container:"
location =
"container:"
...
...
Examples/Programmatic/Grid
View/GridView
.xcodeproj/project.pbxproj
→
Examples/Programmatic/Grid
/Grid
.xcodeproj/project.pbxproj
View file @
8db29285
This diff is collapsed.
Click to expand it.
Examples/Programmatic/Grid
View/GridView
.xcodeproj/project.xcworkspace/contents.xcworkspacedata
→
Examples/Programmatic/Grid
/Grid
.xcodeproj/project.xcworkspace/contents.xcworkspacedata
View file @
8db29285
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
<Workspace
<Workspace
version =
"1.0"
>
version =
"1.0"
>
<FileRef
<FileRef
location =
"self:Grid
View
.xcodeproj"
>
location =
"self:Grid.xcodeproj"
>
</FileRef>
</FileRef>
</Workspace>
</Workspace>
Examples/Programmatic/Grid
View/GridView
/AppDelegate.swift
→
Examples/Programmatic/Grid
/Grid
/AppDelegate.swift
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@2x-1.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@2x-1.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-29@3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@2x-1.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@2x-1.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-40@3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-60@2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-60@2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-60@3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-60@3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-76.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-76.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-76@2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-76@2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/AppIcon.appiconset/Material-Icon-83.5@2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/AppIcon.appiconset/Material-Icon-83.5@2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/CosmicMindInverted.imageset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/CosmicMindInverted.imageset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/CosmicMindInverted.imageset/CosmicMindInverted.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/CosmicMindInverted.imageset/CosmicMindInverted.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_alarm_white.imageset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_alarm_white.imageset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white_2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white_2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white_3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_alarm_white.imageset/ic_alarm_white_3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_auto_white.imageset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_auto_white.imageset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white_2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white_2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white_3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_auto_white.imageset/ic_flash_auto_white_3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_off_white.imageset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_off_white.imageset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white_2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white_2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white_3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_off_white.imageset/ic_flash_off_white_3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_on_white.imageset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_on_white.imageset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white_2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white_2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white_3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_flash_on_white.imageset/ic_flash_on_white_3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_more_vert_white.imageset/Contents.json
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_more_vert_white.imageset/Contents.json
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white_2x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white_2x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white_3x.png
→
Examples/Programmatic/Grid
/Grid
/Assets.xcassets/ic_more_vert_white.imageset/ic_more_vert_white_3x.png
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Base.lproj/LaunchScreen.storyboard
→
Examples/Programmatic/Grid
/Grid
/Base.lproj/LaunchScreen.storyboard
View file @
8db29285
File moved
Examples/Programmatic/Grid
View/GridView
/Info.plist
→
Examples/Programmatic/Grid
/Grid
/Info.plist
View file @
8db29285
...
@@ -28,8 +28,6 @@
...
@@ -28,8 +28,6 @@
<
a
rr
a
y
>
<
a
rr
a
y
>
<
string
>
armv7
<
/string
>
<
string
>
armv7
<
/string
>
<
/
a
rr
a
y
>
<
/
a
rr
a
y
>
<
k
e
y
>
UIStatusBarHidden
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
UISupportedInterfaceOrientations
<
/k
e
y
>
<
k
e
y
>
UISupportedInterfaceOrientations
<
/k
e
y
>
<
a
rr
a
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
...
...
Examples/Programmatic/Grid
View/GridView
/ViewController.swift
→
Examples/Programmatic/Grid
/Grid
/ViewController.swift
View file @
8db29285
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
*/
*/
/**
/**
The following ViewController demonstrates using Grid to make complex layouts.
*/
*/
import
UIKit
import
UIKit
...
@@ -40,10 +40,10 @@ class ViewController: UIViewController {
...
@@ -40,10 +40,10 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
prepareView
()
prepareView
()
// prepareHorizontalGridViewExample()
// prepareHorizontalGridViewExample()
// prepareVerticalGridViewExample()
// prepareVerticalGridViewExample()
// prepareSmallCardViewExample()
// prepareSmallCardViewExample()
// prepareMediumCardViewExample()
// prepareMediumCardViewExample()
prepareLargeCardViewExample
()
prepareLargeCardViewExample
()
}
}
...
@@ -55,8 +55,8 @@ class ViewController: UIViewController {
...
@@ -55,8 +55,8 @@ class ViewController: UIViewController {
/// Prepares the medium card example.
/// Prepares the medium card example.
private
func
prepareLargeCardViewExample
()
{
private
func
prepareLargeCardViewExample
()
{
let
cardView
:
MaterialPulseView
=
MaterialPulseView
(
frame
:
CGRectMake
(
16
,
100
,
view
.
bounds
.
width
-
32
,
35
0
))
let
cardView
:
MaterialPulseView
=
MaterialPulseView
(
frame
:
CGRectMake
(
16
,
100
,
view
.
bounds
.
width
-
32
,
40
0
))
cardView
.
pulseColor
=
MaterialColor
.
blueGrey
.
lighten5
cardView
.
pulseColor
=
MaterialColor
.
blueGrey
.
base
cardView
.
grid
.
axis
.
direction
=
.
Vertical
cardView
.
grid
.
axis
.
direction
=
.
Vertical
cardView
.
depth
=
.
Depth1
cardView
.
depth
=
.
Depth1
view
.
addSubview
(
cardView
)
view
.
addSubview
(
cardView
)
...
@@ -65,6 +65,7 @@ class ViewController: UIViewController {
...
@@ -65,6 +65,7 @@ class ViewController: UIViewController {
imageView
.
grid
.
rows
=
7
imageView
.
grid
.
rows
=
7
imageView
.
grid
.
columns
=
6
imageView
.
grid
.
columns
=
6
imageView
.
grid
.
spacing
=
4
imageView
.
grid
.
spacing
=
4
imageView
.
backgroundColor
=
MaterialColor
.
clear
cardView
.
addSubview
(
imageView
)
cardView
.
addSubview
(
imageView
)
var
image
:
UIImage
?
=
UIImage
(
named
:
"CosmicMindInverted"
)
var
image
:
UIImage
?
=
UIImage
(
named
:
"CosmicMindInverted"
)
...
@@ -78,6 +79,7 @@ class ViewController: UIViewController {
...
@@ -78,6 +79,7 @@ class ViewController: UIViewController {
rightImageViewCollection
.
grid
.
columns
=
3
rightImageViewCollection
.
grid
.
columns
=
3
rightImageViewCollection
.
grid
.
axis
.
direction
=
.
Vertical
rightImageViewCollection
.
grid
.
axis
.
direction
=
.
Vertical
rightImageViewCollection
.
grid
.
spacing
=
4
rightImageViewCollection
.
grid
.
spacing
=
4
rightImageViewCollection
.
backgroundColor
=
MaterialColor
.
clear
imageView
.
addSubview
(
rightImageViewCollection
)
imageView
.
addSubview
(
rightImageViewCollection
)
image
=
UIImage
(
named
:
"CosmicMindInverted"
)
image
=
UIImage
(
named
:
"CosmicMindInverted"
)
...
@@ -169,7 +171,7 @@ class ViewController: UIViewController {
...
@@ -169,7 +171,7 @@ class ViewController: UIViewController {
/// Prepares the medium card example.
/// Prepares the medium card example.
private
func
prepareMediumCardViewExample
()
{
private
func
prepareMediumCardViewExample
()
{
let
cardView
:
MaterialPulseView
=
MaterialPulseView
(
frame
:
CGRectMake
(
16
,
100
,
view
.
bounds
.
width
-
32
,
240
))
let
cardView
:
MaterialPulseView
=
MaterialPulseView
(
frame
:
CGRectMake
(
16
,
100
,
view
.
bounds
.
width
-
32
,
240
))
cardView
.
pulseColor
=
MaterialColor
.
blueGrey
.
lighten5
cardView
.
pulseColor
=
MaterialColor
.
blueGrey
.
base
cardView
.
depth
=
.
Depth1
cardView
.
depth
=
.
Depth1
view
.
addSubview
(
cardView
)
view
.
addSubview
(
cardView
)
...
@@ -254,7 +256,7 @@ class ViewController: UIViewController {
...
@@ -254,7 +256,7 @@ class ViewController: UIViewController {
/// Prepares the small card example.
/// Prepares the small card example.
private
func
prepareSmallCardViewExample
()
{
private
func
prepareSmallCardViewExample
()
{
let
cardView
:
MaterialPulseView
=
MaterialPulseView
(
frame
:
CGRectMake
(
16
,
100
,
view
.
bounds
.
width
-
32
,
152
))
let
cardView
:
MaterialPulseView
=
MaterialPulseView
(
frame
:
CGRectMake
(
16
,
100
,
view
.
bounds
.
width
-
32
,
152
))
cardView
.
pulseColor
=
MaterialColor
.
blueGrey
.
lighten5
cardView
.
pulseColor
=
MaterialColor
.
blueGrey
.
base
cardView
.
depth
=
.
Depth1
cardView
.
depth
=
.
Depth1
view
.
addSubview
(
cardView
)
view
.
addSubview
(
cardView
)
...
@@ -378,7 +380,7 @@ class ViewController: UIViewController {
...
@@ -378,7 +380,7 @@ class ViewController: UIViewController {
label2
.
text
=
"B"
label2
.
text
=
"B"
label2
.
backgroundColor
=
MaterialColor
.
blue
.
base
label2
.
backgroundColor
=
MaterialColor
.
blue
.
base
// view.grid.columns = 9
// view.grid.columns = 9
view
.
grid
.
spacing
=
16
view
.
grid
.
spacing
=
16
view
.
grid
.
contentInset
.
left
=
16
view
.
grid
.
contentInset
.
left
=
16
view
.
grid
.
contentInset
.
right
=
16
view
.
grid
.
contentInset
.
right
=
16
...
...
Sources/Grid.swift
View file @
8db29285
...
@@ -59,6 +59,12 @@ public class GridAxis {
...
@@ -59,6 +59,12 @@ public class GridAxis {
}
}
}
}
/**
Initializer.
- Parameter grid: The Grid reference used for offset values.
- Parameter rows: The number of rows, Vertical axis the grid will use.
- Parameter columns: The number of columns, Horizontal axis the grid will use.
*/
public
init
(
grid
:
Grid
,
rows
:
Int
=
12
,
columns
:
Int
=
12
)
{
public
init
(
grid
:
Grid
,
rows
:
Int
=
12
,
columns
:
Int
=
12
)
{
self
.
grid
=
grid
self
.
grid
=
grid
self
.
rows
=
rows
self
.
rows
=
rows
...
@@ -84,6 +90,12 @@ public class GridOffset {
...
@@ -84,6 +90,12 @@ public class GridOffset {
}
}
}
}
/**
Initializer.
- Parameter grid: The Grid reference used for offset values.
- Parameter rows: The number of rows, Vertical axis the grid will use.
- Parameter columns: The number of columns, Horizontal axis the grid will use.
*/
public
init
(
grid
:
Grid
,
rows
:
Int
=
0
,
columns
:
Int
=
0
)
{
public
init
(
grid
:
Grid
,
rows
:
Int
=
0
,
columns
:
Int
=
0
)
{
self
.
grid
=
grid
self
.
grid
=
grid
self
.
rows
=
rows
self
.
rows
=
rows
...
@@ -140,6 +152,12 @@ public class Grid {
...
@@ -140,6 +152,12 @@ public class Grid {
}
}
}
}
/**
Initializer.
- Parameter rows: The number of rows, Vertical axis the grid will use.
- Parameter columns: The number of columns, Horizontal axis the grid will use.
- Parameter spacing: The spacing between rows or columns.
*/
public
init
(
rows
:
Int
=
12
,
columns
:
Int
=
12
,
spacing
:
CGFloat
=
0
)
{
public
init
(
rows
:
Int
=
12
,
columns
:
Int
=
12
,
spacing
:
CGFloat
=
0
)
{
self
.
rows
=
rows
self
.
rows
=
rows
self
.
columns
=
columns
self
.
columns
=
columns
...
@@ -152,17 +170,14 @@ public class Grid {
...
@@ -152,17 +170,14 @@ public class Grid {
public
func
reloadLayout
()
{
public
func
reloadLayout
()
{
if
let
v
:
Array
<
UIView
>
=
views
{
if
let
v
:
Array
<
UIView
>
=
views
{
var
n
:
Int
=
0
var
n
:
Int
=
0
var
m
:
Int
=
0
for
var
i
:
Int
=
0
,
l
:
Int
=
v
.
count
-
1
;
i
<=
l
;
++
i
{
for
var
i
:
Int
=
0
,
l
:
Int
=
v
.
count
-
1
;
i
<=
l
;
++
i
{
let
view
:
UIView
=
v
[
i
]
let
view
:
UIView
=
v
[
i
]
if
let
sv
:
UIView
=
view
.
superview
{
if
let
sv
:
UIView
=
view
.
superview
{
sv
.
layoutIfNeeded
()
if
.
Horizontal
==
axis
.
direction
{
let
w
:
CGFloat
=
(
sv
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
+
spacing
)
/
CGFloat
(
axis
.
inherited
?
columns
:
axis
.
columns
)
let
w
:
CGFloat
=
(
sv
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
+
spacing
)
/
CGFloat
(
axis
.
inherited
?
columns
:
axis
.
columns
)
let
h
:
CGFloat
=
(
sv
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
+
spacing
)
/
CGFloat
(
axis
.
inherited
?
rows
:
axis
.
rows
)
let
c
:
Int
=
view
.
grid
.
columns
let
c
:
Int
=
view
.
grid
.
columns
let
r
:
Int
=
view
.
grid
.
rows
let
co
:
Int
=
view
.
grid
.
offset
.
columns
let
co
:
Int
=
view
.
grid
.
offset
.
columns
let
ro
:
Int
=
view
.
grid
.
offset
.
rows
if
.
Horizontal
==
axis
.
direction
{
// View height.
// View height.
let
vh
:
CGFloat
=
sv
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
let
vh
:
CGFloat
=
sv
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
...
@@ -173,34 +188,24 @@ public class Grid {
...
@@ -173,34 +188,24 @@ public class Grid {
// View width.
// View width.
let
vw
:
CGFloat
=
(
w
*
CGFloat
(
c
))
-
spacing
let
vw
:
CGFloat
=
(
w
*
CGFloat
(
c
))
-
spacing
if
0
==
i
{
view
.
frame
=
CGRectMake
(
vl
,
contentInset
.
top
,
vw
,
vh
)
view
.
frame
=
CGRectMake
(
vl
,
contentInset
.
top
,
vw
,
vh
)
}
else
if
l
==
i
{
view
.
frame
=
CGRectMake
(
vl
,
contentInset
.
top
,
vw
,
vh
)
}
else
{
view
.
frame
=
CGRectMake
(
vl
,
contentInset
.
top
,
vw
,
vh
)
}
n
+=
c
+
co
-
1
n
+=
c
+
co
-
1
}
else
if
.
Vertical
==
axis
.
direction
{
}
else
if
.
Vertical
==
axis
.
direction
{
let
h
:
CGFloat
=
(
sv
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
+
spacing
)
/
CGFloat
(
axis
.
inherited
?
rows
:
axis
.
rows
)
let
r
:
Int
=
view
.
grid
.
rows
let
ro
:
Int
=
view
.
grid
.
offset
.
rows
// View width.
// View width.
let
vw
:
CGFloat
=
sv
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
let
vw
:
CGFloat
=
sv
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
// View top.
// View top.
let
vt
:
CGFloat
=
CGFloat
(
i
+
m
+
ro
)
*
h
+
contentInset
.
top
let
vt
:
CGFloat
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentInset
.
top
// View height.
// View height.
let
vh
:
CGFloat
=
(
h
*
CGFloat
(
r
))
-
spacing
let
vh
:
CGFloat
=
(
h
*
CGFloat
(
r
))
-
spacing
if
0
==
i
{
view
.
frame
=
CGRectMake
(
contentInset
.
left
,
vt
,
vw
,
vh
)
}
else
if
l
==
i
{
view
.
frame
=
CGRectMake
(
contentInset
.
left
,
vt
,
vw
,
vh
)
}
else
{
view
.
frame
=
CGRectMake
(
contentInset
.
left
,
vt
,
vw
,
vh
)
view
.
frame
=
CGRectMake
(
contentInset
.
left
,
vt
,
vw
,
vh
)
}
n
+=
r
+
ro
-
1
m
+=
r
+
ro
-
1
}
}
}
}
}
}
...
@@ -208,31 +213,48 @@ public class Grid {
...
@@ -208,31 +213,48 @@ public class Grid {
}
}
}
}
private
func
associatedObject
<
T
:
AnyObject
>
(
base
:
AnyObject
,
key
:
UnsafePointer
<
UInt8
>
,
initialiser
:
()
->
T
)
->
T
{
/**
Gets the Obj-C reference for the Grid object within the UIView extension.
- Parameter base: Base object.
- Parameter key: Memory key pointer.
- Parameter initializer: Object initializer.
- Returns: The associated reference for the initializer object.
*/
private
func
GridAssociatedObject
<
T
:
AnyObject
>
(
base
:
AnyObject
,
key
:
UnsafePointer
<
UInt8
>
,
initializer
:
()
->
T
)
->
T
{
if
let
associated
:
T
=
objc_getAssociatedObject
(
base
,
key
)
as?
T
{
if
let
associated
:
T
=
objc_getAssociatedObject
(
base
,
key
)
as?
T
{
return
associated
return
associated
}
}
let
associated
=
initiali
s
er
()
let
associated
=
initiali
z
er
()
objc_setAssociatedObject
(
base
,
key
,
associated
,
.
OBJC_ASSOCIATION_RETAIN
)
objc_setAssociatedObject
(
base
,
key
,
associated
,
.
OBJC_ASSOCIATION_RETAIN
)
return
associated
return
associated
}
}
private
func
associateObject
<
T
:
AnyObject
>
(
base
:
AnyObject
,
key
:
UnsafePointer
<
UInt8
>
,
value
:
T
)
{
/**
Sets the Obj-C reference for the Grid object within the UIView extension.
- Parameter base: Base object.
- Parameter key: Memory key pointer.
- Parameter value: The object instance to set for the associated object.
- Returns: The associated reference for the initializer object.
*/
private
func
GridAssociateObject
<
T
:
AnyObject
>
(
base
:
AnyObject
,
key
:
UnsafePointer
<
UInt8
>
,
value
:
T
)
{
objc_setAssociatedObject
(
base
,
key
,
value
,
.
OBJC_ASSOCIATION_RETAIN
)
objc_setAssociatedObject
(
base
,
key
,
value
,
.
OBJC_ASSOCIATION_RETAIN
)
}
}
/// A memory reference to the Grid instance for UIView extensions.
private
var
gridKey
:
UInt8
=
0
private
var
gridKey
:
UInt8
=
0
/// Grid extension for UIView.
public
extension
UIView
{
public
extension
UIView
{
/// Grid reference.
public
var
grid
:
Grid
{
public
var
grid
:
Grid
{
get
{
get
{
return
a
ssociatedObject
(
self
,
key
:
&
gridKey
)
{
return
GridA
ssociatedObject
(
self
,
key
:
&
gridKey
)
{
return
Grid
()
return
Grid
()
}
}
}
}
set
(
value
)
{
set
(
value
)
{
a
ssociateObject
(
self
,
key
:
&
gridKey
,
value
:
value
)
GridA
ssociateObject
(
self
,
key
:
&
gridKey
,
value
:
value
)
}
}
}
}
}
}
\ 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