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
Show 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 {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -100,7 +100,7 @@ public class BottomTabBar : UITabBar {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/MaterialButton.swift
View file @
b54e9c05
...
@@ -104,7 +104,7 @@ public class MaterialButton : UIButton {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -122,7 +122,7 @@ public class MaterialButton : UIButton {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/MaterialCollectionViewCell.swift
View file @
b54e9c05
...
@@ -211,7 +211,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -229,7 +229,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/MaterialLayer.swift
View file @
b54e9c05
...
@@ -64,7 +64,7 @@ public class MaterialLayer : CAShapeLayer {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -82,7 +82,7 @@ public class MaterialLayer : CAShapeLayer {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/MaterialSwitch.swift
View file @
b54e9c05
...
@@ -94,7 +94,7 @@ public class MaterialSwitch : UIControl {
...
@@ -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
{
@IBInspectable
public
var
width
:
CGFloat
{
get
{
get
{
return
layer
.
frame
.
size
.
width
return
layer
.
frame
.
size
.
width
...
@@ -104,7 +104,7 @@ public class MaterialSwitch : UIControl {
...
@@ -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
{
@IBInspectable
public
var
height
:
CGFloat
{
get
{
get
{
return
layer
.
frame
.
size
.
height
return
layer
.
frame
.
size
.
height
...
...
Sources/iOS/MaterialTableViewCell.swift
View file @
b54e9c05
...
@@ -103,7 +103,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -118,7 +118,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/MaterialView.swift
View file @
b54e9c05
...
@@ -159,7 +159,7 @@ public class MaterialView : UIView {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -177,7 +177,7 @@ public class MaterialView : UIView {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/NavigationBar.swift
View file @
b54e9c05
...
@@ -127,7 +127,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -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
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
value that is not .None, the height will be adjusted to maintain the correct
shape.
shape.
...
@@ -142,7 +142,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -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
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
value that is not .None, the width will be adjusted to maintain the correct
shape.
shape.
...
...
Sources/iOS/TextField.swift
View file @
b54e9c05
...
@@ -74,39 +74,23 @@ public class TextField : UITextField {
...
@@ -74,39 +74,23 @@ public class TextField : UITextField {
}
}
}
}
/**
/// A property that accesses the layer.frame.size.width property.
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.
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
get
{
get
{
return
layer
.
frame
.
size
.
width
return
layer
.
frame
.
size
.
width
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
height
=
value
}
}
}
}
}
/**
/// A property that accesses the layer.frame.size.height property.
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.
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
get
{
get
{
return
layer
.
frame
.
size
.
height
return
layer
.
frame
.
size
.
height
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
width
=
value
}
}
}
}
}
...
@@ -183,11 +167,7 @@ public class TextField : UITextField {
...
@@ -183,11 +167,7 @@ public class TextField : UITextField {
}
}
}
}
/**
/// A property that sets the cornerRadius of the backing layer.
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.
*/
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
None
{
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
None
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
...
@@ -204,27 +184,6 @@ public class TextField : UITextField {
...
@@ -204,27 +184,6 @@ public class TextField : UITextField {
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
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 {
...
@@ -436,7 +395,6 @@ public class TextField : UITextField {
super
.
layoutSublayersOfLayer
(
layer
)
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
if
self
.
layer
==
layer
{
bottomBorderLayer
.
frame
=
CGRectMake
(
0
,
bounds
.
height
+
bottomBorderLayerDistance
,
bounds
.
width
,
1
)
bottomBorderLayer
.
frame
=
CGRectMake
(
0
,
bounds
.
height
+
bottomBorderLayerDistance
,
bounds
.
width
,
1
)
layoutShape
()
layoutShadowPath
()
layoutShadowPath
()
}
}
}
}
...
@@ -513,10 +471,8 @@ public class TextField : UITextField {
...
@@ -513,10 +471,8 @@ public class TextField : UITextField {
/// Reloads the view.
/// Reloads the view.
public
func
reloadView
()
{
public
func
reloadView
()
{
/// Prepare the clearButton.
/// Align the clearButton.
if
let
v
:
FlatButton
=
clearButton
{
clearButton
.
frame
=
CGRectMake
(
width
-
height
,
0
,
height
,
height
)
v
.
frame
=
CGRectMake
(
width
-
height
,
0
,
height
,
height
)
}
}
}
...
@@ -566,16 +522,6 @@ public class TextField : UITextField {
...
@@ -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.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
...
@@ -642,9 +588,7 @@ public class TextField : UITextField {
...
@@ -642,9 +588,7 @@ public class TextField : UITextField {
clearButton
.
tintColor
=
MaterialColor
.
grey
.
base
clearButton
.
tintColor
=
MaterialColor
.
grey
.
base
clearButton
.
setImage
(
image
,
forState
:
.
Normal
)
clearButton
.
setImage
(
image
,
forState
:
.
Normal
)
clearButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
clearButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
if
clearButtonAutoHandleEnabled
{
clearButtonAutoHandleEnabled
=
true
clearButton
.
addTarget
(
self
,
action
:
#selector(
handleClearButton
)
,
forControlEvents
:
.
TouchUpInside
)
}
clearButtonMode
=
.
Never
clearButtonMode
=
.
Never
rightViewMode
=
.
WhileEditing
rightViewMode
=
.
WhileEditing
rightView
=
clearButton
rightView
=
clearButton
...
...
Sources/iOS/TextView.swift
View file @
b54e9c05
...
@@ -76,39 +76,23 @@ public class TextView: UITextView {
...
@@ -76,39 +76,23 @@ public class TextView: UITextView {
}
}
}
}
/**
/// A property that accesses the layer.frame.size.width property.
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.
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
get
{
get
{
return
layer
.
frame
.
size
.
width
return
layer
.
frame
.
size
.
width
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
height
=
value
}
}
}
}
}
/**
/// A property that accesses the layer.frame.size.height property.
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.
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
get
{
get
{
return
layer
.
frame
.
size
.
height
return
layer
.
frame
.
size
.
height
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
layer
.
frame
.
size
.
width
=
value
}
}
}
}
}
...
@@ -185,11 +169,7 @@ public class TextView: UITextView {
...
@@ -185,11 +169,7 @@ public class TextView: UITextView {
}
}
}
}
/**
/// A property that sets the cornerRadius of the backing layer.
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.
*/
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
None
{
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
None
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
...
@@ -206,27 +186,6 @@ public class TextView: UITextView {
...
@@ -206,27 +186,6 @@ public class TextView: UITextView {
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
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 {
...
@@ -389,7 +348,6 @@ public class TextView: UITextView {
public
override
func
layoutSublayersOfLayer
(
layer
:
CALayer
)
{
public
override
func
layoutSublayersOfLayer
(
layer
:
CALayer
)
{
super
.
layoutSublayersOfLayer
(
layer
)
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
if
self
.
layer
==
layer
{
layoutShape
()
layoutShadowPath
()
layoutShadowPath
()
}
}
}
}
...
@@ -489,16 +447,6 @@ public class TextView: UITextView {
...
@@ -489,16 +447,6 @@ public class TextView: UITextView {
titleLabel
?
.
textColor
=
titleLabelColor
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.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
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