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
bdd34155
Commit
bdd34155
authored
Sep 25, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added enum for contentsGravity
parent
817985c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
4 deletions
+54
-4
Source/MaterialTheme+View.swift
+52
-2
Source/MaterialView.swift
+2
-2
No files found.
Source/MaterialTheme+View.swift
View file @
bdd34155
...
@@ -18,6 +18,56 @@
...
@@ -18,6 +18,56 @@
import
UIKit
import
UIKit
/**
:name: MaterialGravity
*/
public
enum
MaterialGravity
{
case
Center
case
Top
case
Bottom
case
Left
case
Right
case
TopLeft
case
TopRight
case
BottomLeft
case
BottomRight
case
Resize
case
ResizeAspect
case
ResizeAspectFill
}
/**
:name: MaterialGravityToString
*/
public
func
MaterialGravityToString
(
gravity
:
MaterialGravity
)
->
String
{
switch
gravity
{
case
.
Center
:
return
kCAGravityCenter
case
.
Top
:
return
kCAGravityTop
case
.
Bottom
:
return
kCAGravityBottom
case
.
Left
:
return
kCAGravityLeft
case
.
Right
:
return
kCAGravityRight
case
.
TopLeft
:
return
kCAGravityTopLeft
case
.
TopRight
:
return
kCAGravityTopRight
case
.
BottomLeft
:
return
kCAGravityBottomLeft
case
.
BottomRight
:
return
kCAGravityBottomRight
case
.
Resize
:
return
kCAGravityResize
case
.
ResizeAspect
:
return
kCAGravityResizeAspect
case
.
ResizeAspectFill
:
return
kCAGravityResizeAspectFill
}
}
// MaterialTheme
// MaterialTheme
public
extension
MaterialTheme
{
public
extension
MaterialTheme
{
public
struct
view
{}
public
struct
view
{}
...
@@ -46,7 +96,7 @@ public extension MaterialTheme.view {
...
@@ -46,7 +96,7 @@ public extension MaterialTheme.view {
public
static
let
userInteractionEnabled
:
Bool
=
true
public
static
let
userInteractionEnabled
:
Bool
=
true
// image
// image
public
static
let
contentsGravity
:
String
=
kCAGravity
ResizeAspectFill
public
static
let
contentsGravity
:
MaterialGravity
=
.
ResizeAspectFill
public
static
let
contentsRect
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
let
contentsRect
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
let
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
public
static
let
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
}
}
...
@@ -74,7 +124,7 @@ public extension MaterialTheme.navigation {
...
@@ -74,7 +124,7 @@ public extension MaterialTheme.navigation {
public
static
let
userInteractionEnabled
:
Bool
=
false
public
static
let
userInteractionEnabled
:
Bool
=
false
// image
// image
public
static
let
contentsGravity
:
String
=
MaterialTheme
.
view
.
contentsGravity
public
static
let
contentsGravity
:
MaterialGravity
=
MaterialTheme
.
view
.
contentsGravity
public
static
let
contentsRect
:
CGRect
=
MaterialTheme
.
view
.
contentsRect
public
static
let
contentsRect
:
CGRect
=
MaterialTheme
.
view
.
contentsRect
public
static
let
contentsScale
:
CGFloat
=
MaterialTheme
.
view
.
contentsScale
public
static
let
contentsScale
:
CGFloat
=
MaterialTheme
.
view
.
contentsScale
}
}
...
...
Source/MaterialView.swift
View file @
bdd34155
...
@@ -32,9 +32,9 @@ public class MaterialView: UIView {
...
@@ -32,9 +32,9 @@ public class MaterialView: UIView {
/**
/**
:name: contentsGravity
:name: contentsGravity
*/
*/
public
var
contentsGravity
:
String
!
{
public
var
contentsGravity
:
MaterialGravity
!
{
didSet
{
didSet
{
layer
.
contentsGravity
=
contentsGravity
layer
.
contentsGravity
=
MaterialGravityToString
(
contentsGravity
)
}
}
}
}
...
...
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