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
cbbcbe5e
Commit
cbbcbe5e
authored
May 26, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue with BarView types init methods and defaults
parent
bfcb8114
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
64 deletions
+53
-64
Examples/Material.xcworkspace/contents.xcworkspacedata
+3
-3
Sources/iOS/BarView.swift
+1
-6
Sources/iOS/ControlView.swift
+14
-6
Sources/iOS/SearchBar.swift
+1
-6
Sources/iOS/SearchBarController.swift
+16
-14
Sources/iOS/TextField.swift
+1
-9
Sources/iOS/Toolbar.swift
+1
-6
Sources/iOS/ToolbarController.swift
+16
-14
No files found.
Examples/Material.xcworkspace/contents.xcworkspacedata
View file @
cbbcbe5e
...
@@ -59,6 +59,9 @@
...
@@ -59,6 +59,9 @@
location =
"group:Programmatic/MenuController/MenuController.xcodeproj"
>
location =
"group:Programmatic/MenuController/MenuController.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
location =
"group:Programmatic/ControlView/ControlView.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:Programmatic/TabBar/TabBar.xcodeproj"
>
location =
"group:Programmatic/TabBar/TabBar.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
...
@@ -83,9 +86,6 @@
...
@@ -83,9 +86,6 @@
location =
"group:Programmatic/SideNavigationController/SideNavigationController.xcodeproj"
>
location =
"group:Programmatic/SideNavigationController/SideNavigationController.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
location =
"group:Programmatic/ControlView/ControlView.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:Programmatic/CardView/CardView.xcodeproj"
>
location =
"group:Programmatic/CardView/CardView.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
...
...
Sources/iOS/BarView.swift
View file @
cbbcbe5e
...
@@ -59,17 +59,12 @@ public class BarView : ControlView {
...
@@ -59,17 +59,12 @@ public class BarView : ControlView {
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
}
}
/// Convenience initializer.
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectZero
)
}
/**
/**
A convenience initializer with parameter settings.
A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
*/
public
override
init
(
leftControls
:
Array
<
UIControl
>
?
,
rightControls
:
Array
<
UIControl
>
?
)
{
public
override
init
(
leftControls
:
Array
<
UIControl
>
?
=
nil
,
rightControls
:
Array
<
UIControl
>
?
=
nil
)
{
super
.
init
(
leftControls
:
leftControls
,
rightControls
:
rightControls
)
super
.
init
(
leftControls
:
leftControls
,
rightControls
:
rightControls
)
}
}
...
...
Sources/iOS/ControlView.swift
View file @
cbbcbe5e
...
@@ -73,8 +73,16 @@ public class ControlView : MaterialView {
...
@@ -73,8 +73,16 @@ public class ControlView : MaterialView {
}
}
}
}
/// Grid cell factor.
@IBInspectable
public
var
gridFactor
:
CGFloat
=
24
{
didSet
{
assert
(
0
<
gridFactor
,
"[Material Error: gridFactor must be greater than 0.]"
)
layoutSubviews
()
}
}
/// ContentView that holds the any desired subviews.
/// ContentView that holds the any desired subviews.
public
private(set)
lazy
var
contentView
:
MaterialView
=
MaterialView
()
public
private(set)
var
contentView
:
MaterialView
!
/// Left side UIControls.
/// Left side UIControls.
public
var
leftControls
:
Array
<
UIControl
>
?
{
public
var
leftControls
:
Array
<
UIControl
>
?
{
...
@@ -136,7 +144,6 @@ public class ControlView : MaterialView {
...
@@ -136,7 +144,6 @@ public class ControlView : MaterialView {
public
init
()
{
public
init
()
{
super
.
init
(
frame
:
CGRectZero
)
super
.
init
(
frame
:
CGRectZero
)
frame
.
size
=
intrinsicContentSize
()
frame
.
size
=
intrinsicContentSize
()
frame
.
size
.
width
=
MaterialDevice
.
width
prepareView
()
prepareView
()
}
}
...
@@ -147,6 +154,7 @@ public class ControlView : MaterialView {
...
@@ -147,6 +154,7 @@ public class ControlView : MaterialView {
*/
*/
public
init
(
leftControls
:
Array
<
UIControl
>
?
=
nil
,
rightControls
:
Array
<
UIControl
>
?
=
nil
)
{
public
init
(
leftControls
:
Array
<
UIControl
>
?
=
nil
,
rightControls
:
Array
<
UIControl
>
?
=
nil
)
{
super
.
init
(
frame
:
CGRectZero
)
super
.
init
(
frame
:
CGRectZero
)
frame
.
size
=
intrinsicContentSize
()
prepareView
()
prepareView
()
prepareProperties
(
leftControls
,
rightControls
:
rightControls
)
prepareProperties
(
leftControls
,
rightControls
:
rightControls
)
}
}
...
@@ -156,8 +164,7 @@ public class ControlView : MaterialView {
...
@@ -156,8 +164,7 @@ public class ControlView : MaterialView {
if
willRenderView
{
if
willRenderView
{
layoutIfNeeded
()
layoutIfNeeded
()
let
factor
:
CGFloat
=
24
if
let
g
:
Int
=
Int
(
width
/
gridFactor
)
{
if
let
g
:
Int
=
Int
(
width
/
factor
)
{
let
columns
:
Int
=
g
+
1
let
columns
:
Int
=
g
+
1
grid
.
views
=
[]
grid
.
views
=
[]
...
@@ -172,7 +179,7 @@ public class ControlView : MaterialView {
...
@@ -172,7 +179,7 @@ public class ControlView : MaterialView {
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsetsZero
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsetsZero
c
.
frame
.
size
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
frame
.
size
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
let
q
:
Int
=
Int
(
w
/
f
actor
)
let
q
:
Int
=
Int
(
w
/
gridF
actor
)
c
.
grid
.
columns
=
q
+
1
c
.
grid
.
columns
=
q
+
1
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
...
@@ -192,7 +199,7 @@ public class ControlView : MaterialView {
...
@@ -192,7 +199,7 @@ public class ControlView : MaterialView {
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsetsZero
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsetsZero
c
.
frame
.
size
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
frame
.
size
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
let
q
:
Int
=
Int
(
w
/
f
actor
)
let
q
:
Int
=
Int
(
w
/
gridF
actor
)
c
.
grid
.
columns
=
q
+
1
c
.
grid
.
columns
=
q
+
1
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
...
@@ -241,6 +248,7 @@ public class ControlView : MaterialView {
...
@@ -241,6 +248,7 @@ public class ControlView : MaterialView {
/// Prepares the contentView.
/// Prepares the contentView.
private
func
prepareContentView
()
{
private
func
prepareContentView
()
{
contentView
=
MaterialView
()
contentView
.
backgroundColor
=
nil
contentView
.
backgroundColor
=
nil
addSubview
(
contentView
)
addSubview
(
contentView
)
}
}
...
...
Sources/iOS/SearchBar.swift
View file @
cbbcbe5e
...
@@ -111,17 +111,12 @@ public class SearchBar : BarView {
...
@@ -111,17 +111,12 @@ public class SearchBar : BarView {
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
}
}
/// Convenience initializer.
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectZero
)
}
/**
/**
A convenience initializer with parameter settings.
A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
*/
public
override
init
(
leftControls
:
Array
<
UIControl
>
?
,
rightControls
:
Array
<
UIControl
>
?
)
{
public
override
init
(
leftControls
:
Array
<
UIControl
>
?
=
nil
,
rightControls
:
Array
<
UIControl
>
?
=
nil
)
{
super
.
init
(
leftControls
:
leftControls
,
rightControls
:
rightControls
)
super
.
init
(
leftControls
:
leftControls
,
rightControls
:
rightControls
)
}
}
...
...
Sources/iOS/SearchBarController.swift
View file @
cbbcbe5e
...
@@ -59,21 +59,23 @@ public class SearchBarController : BarController {
...
@@ -59,21 +59,23 @@ public class SearchBarController : BarController {
/// Layout subviews.
/// Layout subviews.
public
func
layoutSubviews
()
{
public
func
layoutSubviews
()
{
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
isLandscape
{
if
let
v
:
SearchBar
=
searchBar
{
searchBar
.
contentInset
.
top
=
4
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
isLandscape
{
}
else
{
v
.
contentInset
.
top
=
4
searchBar
.
contentInset
.
top
=
24
}
else
{
v
.
contentInset
.
top
=
24
}
let
h
:
CGFloat
=
MaterialDevice
.
height
let
w
:
CGFloat
=
MaterialDevice
.
width
let
p
:
CGFloat
=
searchBar
.
intrinsicContentSize
()
.
height
v
.
width
=
w
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
}
let
h
:
CGFloat
=
MaterialDevice
.
height
let
w
:
CGFloat
=
MaterialDevice
.
width
let
p
:
CGFloat
=
searchBar
.
intrinsicContentSize
()
.
height
searchBar
.
width
=
w
searchBar
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
}
/**
/**
...
...
Sources/iOS/TextField.swift
View file @
cbbcbe5e
...
@@ -50,12 +50,7 @@ public class TextField : UITextField {
...
@@ -50,12 +50,7 @@ public class TextField : UITextField {
}
}
}
}
/**
/// A property that accesses the backing layer's backgroundColor.
This property adds a padding to placeholder y position animation
*/
public
var
placeholderAnimationPadding
:
CGFloat
=
0
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
public
override
var
backgroundColor
:
UIColor
?
{
@IBInspectable
public
override
var
backgroundColor
:
UIColor
?
{
didSet
{
didSet
{
layer
.
backgroundColor
=
backgroundColor
?
.
CGColor
layer
.
backgroundColor
=
backgroundColor
?
.
CGColor
...
@@ -233,9 +228,6 @@ public class TextField : UITextField {
...
@@ -233,9 +228,6 @@ public class TextField : UITextField {
}
}
}
}
/// Vertical distance of detail label to divider
public
var
detailDistance
:
CGFloat
=
8
/// Vertical distance for the detailLabel from the divider.
/// Vertical distance for the detailLabel from the divider.
@IBInspectable
public
var
detailVerticalDistanceFromDivider
:
CGFloat
=
8
{
@IBInspectable
public
var
detailVerticalDistanceFromDivider
:
CGFloat
=
8
{
didSet
{
didSet
{
...
...
Sources/iOS/Toolbar.swift
View file @
cbbcbe5e
...
@@ -74,17 +74,12 @@ public class Toolbar : BarView {
...
@@ -74,17 +74,12 @@ public class Toolbar : BarView {
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
}
}
/// Convenience initializer.
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectZero
)
}
/**
/**
A convenience initializer with parameter settings.
A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter leftControls: An Array of UIControls that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side.
- Parameter rightControls: An Array of UIControls that go on the right side.
*/
*/
public
override
init
(
leftControls
:
Array
<
UIControl
>
?
,
rightControls
:
Array
<
UIControl
>
?
)
{
public
override
init
(
leftControls
:
Array
<
UIControl
>
?
=
nil
,
rightControls
:
Array
<
UIControl
>
?
=
nil
)
{
super
.
init
(
leftControls
:
leftControls
,
rightControls
:
rightControls
)
super
.
init
(
leftControls
:
leftControls
,
rightControls
:
rightControls
)
}
}
...
...
Sources/iOS/ToolbarController.swift
View file @
cbbcbe5e
...
@@ -158,21 +158,23 @@ public class ToolbarController : BarController {
...
@@ -158,21 +158,23 @@ public class ToolbarController : BarController {
/// Layout subviews.
/// Layout subviews.
public
func
layoutSubviews
()
{
public
func
layoutSubviews
()
{
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
isLandscape
{
if
let
v
:
Toolbar
=
toolbar
{
toolbar
.
contentInset
.
top
=
4
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
isLandscape
{
}
else
{
v
.
contentInset
.
top
=
4
toolbar
.
contentInset
.
top
=
24
}
else
{
v
.
contentInset
.
top
=
24
}
let
h
:
CGFloat
=
MaterialDevice
.
height
let
w
:
CGFloat
=
MaterialDevice
.
width
let
p
:
CGFloat
=
v
.
intrinsicContentSize
()
.
height
v
.
width
=
w
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
}
let
h
:
CGFloat
=
MaterialDevice
.
height
let
w
:
CGFloat
=
MaterialDevice
.
width
let
p
:
CGFloat
=
toolbar
.
intrinsicContentSize
()
.
height
toolbar
.
width
=
w
toolbar
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
}
/**
/**
...
...
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