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
b54e9c05
Commit
b54e9c05
authored
Apr 05, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed shape code that was not needed in TextField and TextView.
parent
3cafeeb0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
133 deletions
+25
-133
Sources/iOS/BottomTabBar.swift
+2
-2
Sources/iOS/MaterialButton.swift
+2
-2
Sources/iOS/MaterialCollectionViewCell.swift
+2
-2
Sources/iOS/MaterialLayer.swift
+2
-2
Sources/iOS/MaterialSwitch.swift
+2
-2
Sources/iOS/MaterialTableViewCell.swift
+2
-2
Sources/iOS/MaterialView.swift
+2
-2
Sources/iOS/NavigationBar.swift
+2
-2
Sources/iOS/TextField.swift
+6
-62
Sources/iOS/TextView.swift
+3
-55
No files found.
Sources/iOS/BottomTabBar.swift
View file @
b54e9c05
...
...
@@ -85,7 +85,7 @@ public class BottomTabBar : UITabBar {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -100,7 +100,7 @@ public class BottomTabBar : UITabBar {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/MaterialButton.swift
View file @
b54e9c05
...
...
@@ -104,7 +104,7 @@ public class MaterialButton : UIButton {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -122,7 +122,7 @@ public class MaterialButton : UIButton {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/MaterialCollectionViewCell.swift
View file @
b54e9c05
...
...
@@ -211,7 +211,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -229,7 +229,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/MaterialLayer.swift
View file @
b54e9c05
...
...
@@ -64,7 +64,7 @@ public class MaterialLayer : CAShapeLayer {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -82,7 +82,7 @@ public class MaterialLayer : CAShapeLayer {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/MaterialSwitch.swift
View file @
b54e9c05
...
...
@@ -94,7 +94,7 @@ public class MaterialSwitch : UIControl {
}
}
/// A property that accesses the layer.frame.
origin
.width property.
/// A property that accesses the layer.frame.
size
.width property.
@IBInspectable
public
var
width
:
CGFloat
{
get
{
return
layer
.
frame
.
size
.
width
...
...
@@ -104,7 +104,7 @@ public class MaterialSwitch : UIControl {
}
}
/// A property that accesses the layer.frame.
origin
.height property.
/// A property that accesses the layer.frame.
size
.height property.
@IBInspectable
public
var
height
:
CGFloat
{
get
{
return
layer
.
frame
.
size
.
height
...
...
Sources/iOS/MaterialTableViewCell.swift
View file @
b54e9c05
...
...
@@ -103,7 +103,7 @@ public class MaterialTableViewCell : UITableViewCell {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -118,7 +118,7 @@ public class MaterialTableViewCell : UITableViewCell {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/MaterialView.swift
View file @
b54e9c05
...
...
@@ -159,7 +159,7 @@ public class MaterialView : UIView {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -177,7 +177,7 @@ public class MaterialView : UIView {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/NavigationBar.swift
View file @
b54e9c05
...
...
@@ -127,7 +127,7 @@ public class NavigationBar : UINavigationBar {
}
/**
A property that accesses the layer.frame.
origin
.width property.
A property that accesses the layer.frame.
size
.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.
...
...
@@ -142,7 +142,7 @@ public class NavigationBar : UINavigationBar {
}
/**
A property that accesses the layer.frame.
origin
.height property.
A property that accesses the layer.frame.
size
.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.
...
...
Sources/iOS/TextField.swift
View file @
b54e9c05
...
...
@@ -74,39 +74,23 @@ public class TextField : UITextField {
}
}
/**
A 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.
*/
/// A property that accesses the layer.frame.size.width property.
@IBInspectable
public
var
width
:
CGFloat
{
get
{
return
layer
.
frame
.
size
.
width
}
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
height
=
value
}
}
}
/**
A 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.
*/
/// A property that accesses the layer.frame.size.height property.
@IBInspectable
public
var
height
:
CGFloat
{
get
{
return
layer
.
frame
.
size
.
height
}
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
width
=
value
}
}
}
...
...
@@ -183,11 +167,7 @@ public class TextField : UITextField {
}
}
/**
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .Circle when the cornerRadius is set, it will
become .None, as it no longer maintains its circle shape.
*/
/// A property that sets the cornerRadius of the backing layer.
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
None
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
...
...
@@ -204,27 +184,6 @@ public class TextField : UITextField {
set
(
value
)
{
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
*/
public
var
shape
:
MaterialShape
=
.
None
{
didSet
{
if
.
None
!=
shape
{
if
width
<
height
{
frame
.
size
.
width
=
height
}
else
{
frame
.
size
.
height
=
width
}
layoutShadowPath
()
}
}
}
...
...
@@ -436,7 +395,6 @@ public class TextField : UITextField {
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
bottomBorderLayer
.
frame
=
CGRectMake
(
0
,
bounds
.
height
+
bottomBorderLayerDistance
,
bounds
.
width
,
1
)
layoutShape
()
layoutShadowPath
()
}
}
...
...
@@ -513,10 +471,8 @@ public class TextField : UITextField {
/// Reloads the view.
public
func
reloadView
()
{
/// Prepare the clearButton.
if
let
v
:
FlatButton
=
clearButton
{
v
.
frame
=
CGRectMake
(
width
-
height
,
0
,
height
,
height
)
}
/// Align the clearButton.
clearButton
.
frame
=
CGRectMake
(
width
-
height
,
0
,
height
,
height
)
}
...
...
@@ -566,16 +522,6 @@ public class TextField : UITextField {
}
}
/// Manages the layout for the shape of the view instance.
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
let
w
:
CGFloat
=
(
width
/
2
)
if
w
!=
cornerRadius
{
cornerRadius
=
w
}
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
...
...
@@ -642,9 +588,7 @@ public class TextField : UITextField {
clearButton
.
tintColor
=
MaterialColor
.
grey
.
base
clearButton
.
setImage
(
image
,
forState
:
.
Normal
)
clearButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
if
clearButtonAutoHandleEnabled
{
clearButton
.
addTarget
(
self
,
action
:
#selector(
handleClearButton
)
,
forControlEvents
:
.
TouchUpInside
)
}
clearButtonAutoHandleEnabled
=
true
clearButtonMode
=
.
Never
rightViewMode
=
.
WhileEditing
rightView
=
clearButton
...
...
Sources/iOS/TextView.swift
View file @
b54e9c05
...
...
@@ -76,39 +76,23 @@ public class TextView: UITextView {
}
}
/**
A 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.
*/
/// A property that accesses the layer.frame.size.width property.
@IBInspectable
public
var
width
:
CGFloat
{
get
{
return
layer
.
frame
.
size
.
width
}
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
height
=
value
}
}
}
/**
A 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.
*/
/// A property that accesses the layer.frame.size.height property.
@IBInspectable
public
var
height
:
CGFloat
{
get
{
return
layer
.
frame
.
size
.
height
}
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
width
=
value
}
}
}
...
...
@@ -185,11 +169,7 @@ public class TextView: UITextView {
}
}
/**
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .Circle when the cornerRadius is set, it will
become .None, as it no longer maintains its circle shape.
*/
/// A property that sets the cornerRadius of the backing layer.
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
None
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
...
...
@@ -206,27 +186,6 @@ public class TextView: UITextView {
set
(
value
)
{
layer
.
cornerRadius
=
value
layoutShadowPath
()
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
*/
public
var
shape
:
MaterialShape
=
.
None
{
didSet
{
if
.
None
!=
shape
{
if
width
<
height
{
frame
.
size
.
width
=
height
}
else
{
frame
.
size
.
height
=
width
}
layoutShadowPath
()
}
}
}
...
...
@@ -389,7 +348,6 @@ public class TextView: UITextView {
public
override
func
layoutSublayersOfLayer
(
layer
:
CALayer
)
{
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
layoutShape
()
layoutShadowPath
()
}
}
...
...
@@ -489,16 +447,6 @@ public class TextView: UITextView {
titleLabel
?
.
textColor
=
titleLabelColor
}
/// Manages the layout for the shape of the view instance.
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
let
w
:
CGFloat
=
(
width
/
2
)
if
w
!=
cornerRadius
{
cornerRadius
=
w
}
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
...
...
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