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
4dbaa51d
Commit
4dbaa51d
authored
May 10, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjusted sizing for NavigationBar
parent
beff5c45
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
243 additions
and
263 deletions
+243
-263
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
+6
-6
Examples/Programmatic/App/App/ItemViewController.swift
+10
-21
Examples/Programmatic/App/App/RecipesViewController.swift
+4
-10
Examples/Programmatic/CardView/CardView/ViewController.swift
+3
-3
Examples/Programmatic/ImageCardView/ImageCardView/ViewController.swift
+1
-1
Examples/Programmatic/MaterialIcon/MaterialIcon/ViewController.swift
+1
-1
Examples/Programmatic/TableCardView/TableCardView/ViewController.swift
+3
-3
Examples/Storyboards/CardView/CardView/ViewController.swift
+2
-2
Sources/iOS/CardView.swift
+23
-23
Sources/iOS/ControlView.swift
+6
-6
Sources/iOS/ImageCardView.swift
+26
-26
Sources/iOS/MaterialButton.swift
+4
-0
Sources/iOS/NavigationBar.swift
+108
-145
Sources/iOS/NavigationController.swift
+1
-1
Sources/iOS/NavigationItem.swift
+26
-8
Sources/iOS/SearchBar.swift
+9
-3
Sources/iOS/StatusBarView.swift
+1
-1
Sources/iOS/Toolbar.swift
+9
-3
No files found.
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
View file @
4dbaa51d
...
...
@@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */
96162C6C1CA71C8700E3A235
/* VideoViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96162C6B1CA71C8700E3A235
/* VideoViewController.swift */
;
};
96162C6E1CA7274E00E3A235
/* PhotoViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96162C6D1CA7274E00E3A235
/* PhotoViewController.swift */
;
};
961F19
2F1CE14C3E008927C5
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961F192E1CE14C3E
008927C5
/* Material.framework */
;
};
961F193
01CE14C3E008927C5
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961F192E1CE14C3E
008927C5
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
961F19
321CE2579D008927C5
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961F19311CE2579D
008927C5
/* Material.framework */
;
};
961F193
31CE2579D008927C5
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961F19311CE2579D
008927C5
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
9663F9321C7A744600AF0965
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9311C7A744600AF0965
/* AppDelegate.swift */
;
};
9663F9341C7A744600AF0965
/* RecommendationViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9331C7A744600AF0965
/* RecommendationViewController.swift */
;
};
9663F9391C7A744600AF0965
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9381C7A744600AF0965
/* Assets.xcassets */
;
};
...
...
@@ -30,7 +30,7 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
961F193
01CE14C3E
008927C5
/* Material.framework in Embed Frameworks */
,
961F193
31CE2579D
008927C5
/* Material.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -40,7 +40,7 @@
/* Begin PBXFileReference section */
96162C6B1CA71C8700E3A235
/* VideoViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
VideoViewController.swift
;
sourceTree
=
"<group>"
;
};
96162C6D1CA7274E00E3A235
/* PhotoViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PhotoViewController.swift
;
sourceTree
=
"<group>"
;
};
961F19
2E1CE14C3E008927C5
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
Material.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh
/Build/Products/Debug-iphoneos/Material.framework"
;
sourceTree
=
"<absolute>"
;
};
961F19
311CE2579D008927C5
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
Material.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/CosmicMind-hgvxkqfizbxkrsfcxbtlafgqkbve
/Build/Products/Debug-iphoneos/Material.framework"
;
sourceTree
=
"<absolute>"
;
};
9663F92E1C7A744600AF0965
/* App.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
App.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9663F9311C7A744600AF0965
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
9663F9331C7A744600AF0965
/* RecommendationViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RecommendationViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -60,7 +60,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
961F19
2F1CE14C3E
008927C5
/* Material.framework in Frameworks */
,
961F19
321CE2579D
008927C5
/* Material.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -70,7 +70,7 @@
9663F9251C7A744500AF0965
=
{
isa
=
PBXGroup
;
children
=
(
961F19
2E1CE14C3E
008927C5
/* Material.framework */
,
961F19
311CE2579D
008927C5
/* Material.framework */
,
9663F9301C7A744600AF0965
/* App */
,
9663F92F1C7A744600AF0965
/* Products */
,
);
...
...
Examples/Programmatic/App/App/ItemViewController.swift
View file @
4dbaa51d
...
...
@@ -66,7 +66,6 @@ class ItemViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepareView
()
prepareTitleLabel
()
prepareShareButton
()
prepareNavigationItem
()
prepareScrollView
()
...
...
@@ -101,22 +100,6 @@ class ItemViewController: UIViewController {
automaticallyAdjustsScrollViewInsets
=
false
}
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
titleLabel
=
UILabel
()
titleLabel
.
text
=
"Item"
titleLabel
.
textAlignment
=
.
Left
titleLabel
.
textColor
=
MaterialColor
.
white
}
/// Prepares the detailLabel.
private
func
prepareDetailLabel
()
{
detailLabel
=
UILabel
()
detailLabel
.
text
=
"January 22, 2016"
detailLabel
.
textAlignment
=
.
Left
detailLabel
.
textColor
=
MaterialColor
.
white
}
/// Prepares the shareButton.
private
func
prepareShareButton
()
{
let
image
:
UIImage
?
=
MaterialIcon
.
cm
.
share
...
...
@@ -128,8 +111,14 @@ class ItemViewController: UIViewController {
/// Prepares the navigationItem.
private
func
prepareNavigationItem
()
{
navigationItem
.
titleLabel
=
titleLabel
navigationItem
.
detailLabel
=
detailLabel
navigationItem
.
title
=
"Item"
navigationItem
.
titleLabel
.
textAlignment
=
.
Left
navigationItem
.
titleLabel
.
textColor
=
MaterialColor
.
white
navigationItem
.
detail
=
"January 22, 2016"
navigationItem
.
detailLabel
.
textAlignment
=
.
Left
navigationItem
.
detailLabel
.
textColor
=
MaterialColor
.
white
navigationItem
.
rightControls
=
[
shareButton
]
}
...
...
@@ -163,8 +152,8 @@ class ItemViewController: UIViewController {
detailLabel
.
font
=
RobotoFont
.
regular
detailLabel
.
numberOfLines
=
0
imageCardView
.
detail
View
=
detailLabel
imageCardView
.
detail
ViewInset
.
top
=
52
imageCardView
.
content
View
=
detailLabel
imageCardView
.
content
ViewInset
.
top
=
52
let
image
:
UIImage
?
=
UIImage
(
named
:
data
[
"image"
]
as!
String
)
imageCardView
.
image
=
image
...
...
Examples/Programmatic/App/App/RecipesViewController.swift
View file @
4dbaa51d
...
...
@@ -54,7 +54,6 @@ class RecipesViewController: UIViewController {
super
.
viewDidLoad
()
prepareView
()
prepareItems
()
prepareTitleLabel
()
prepareMenuButton
()
prepareSwitchControl
()
prepareSearchButton
()
...
...
@@ -218,14 +217,6 @@ class RecipesViewController: UIViewController {
view
.
backgroundColor
=
MaterialColor
.
white
}
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
titleLabel
=
UILabel
()
titleLabel
.
text
=
"Recipes"
titleLabel
.
textAlignment
=
.
Left
titleLabel
.
textColor
=
MaterialColor
.
white
}
/// Prepares the menuButton.
private
func
prepareMenuButton
()
{
let
image
:
UIImage
?
=
MaterialIcon
.
cm
.
menu
...
...
@@ -253,7 +244,10 @@ class RecipesViewController: UIViewController {
/// Prepares the navigationItem.
private
func
prepareNavigationItem
()
{
navigationItem
.
titleLabel
=
titleLabel
navigationItem
.
title
=
"Recipes"
navigationItem
.
titleLabel
.
textAlignment
=
.
Left
navigationItem
.
titleLabel
.
textColor
=
MaterialColor
.
white
navigationItem
.
leftControls
=
[
menuButton
]
navigationItem
.
rightControls
=
[
switchControl
,
searchButton
]
}
...
...
Examples/Programmatic/CardView/CardView/ViewController.swift
View file @
4dbaa51d
...
...
@@ -61,7 +61,7 @@ class ViewController: UIViewController {
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
cardView
.
detail
View
=
detailLabel
cardView
.
content
View
=
detailLabel
// Yes button.
let
btn1
:
FlatButton
=
FlatButton
()
...
...
@@ -106,7 +106,7 @@ class ViewController: UIViewController {
detailLabel
.
text
=
"Beautiful Material Design"
detailLabel
.
textColor
=
MaterialColor
.
white
detailLabel
.
numberOfLines
=
0
cardView
.
detail
View
=
detailLabel
cardView
.
content
View
=
detailLabel
// Share button.
let
img1
:
UIImage
?
=
MaterialIcon
.
cm
.
share
...
...
@@ -147,7 +147,7 @@ class ViewController: UIViewController {
detailLabel
.
text
=
"Data-Driven Framework"
detailLabel
.
textColor
=
MaterialColor
.
white
detailLabel
.
numberOfLines
=
0
cardView
.
detail
View
=
detailLabel
cardView
.
content
View
=
detailLabel
// Share button.
let
img1
:
UIImage
?
=
MaterialIcon
.
cm
.
share
...
...
Examples/Programmatic/ImageCardView/ImageCardView/ViewController.swift
View file @
4dbaa51d
...
...
@@ -65,7 +65,7 @@ class ViewController: UIViewController {
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
imageCardView
.
detail
View
=
detailLabel
imageCardView
.
content
View
=
detailLabel
// Yes button.
let
btn1
:
FlatButton
=
FlatButton
()
...
...
Examples/Programmatic/MaterialIcon/MaterialIcon/ViewController.swift
View file @
4dbaa51d
...
...
@@ -29,7 +29,7 @@
*/
/*
The following is an example of setting a UITableView as the
detail
View for a
The following is an example of setting a UITableView as the
content
View for a
CardView.
*/
...
...
Examples/Programmatic/TableCardView/TableCardView/ViewController.swift
View file @
4dbaa51d
...
...
@@ -29,7 +29,7 @@
*/
/*
The following is an example of setting a UITableView as the
detail
View for a
The following is an example of setting a UITableView as the
content
View for a
CardView.
*/
...
...
@@ -91,7 +91,7 @@ class ViewController: UIViewController {
cardView
.
contentInsetPreset
=
.
None
cardView
.
leftButtonsInsetPreset
=
.
Square2
cardView
.
rightButtonsInsetPreset
=
.
Square2
cardView
.
detail
ViewInsetPreset
=
.
None
cardView
.
content
ViewInsetPreset
=
.
None
let
titleLabel
:
UILabel
=
UILabel
()
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
20
)
...
...
@@ -113,7 +113,7 @@ class ViewController: UIViewController {
// Use MaterialLayout to easily align the tableView.
cardView
.
titleLabel
=
titleLabel
cardView
.
detail
View
=
tableView
cardView
.
content
View
=
tableView
cardView
.
leftButtons
=
[
closeButton
]
cardView
.
rightButtons
=
[
settingButton
]
...
...
Examples/Storyboards/CardView/CardView/ViewController.swift
View file @
4dbaa51d
...
...
@@ -60,7 +60,7 @@ class ViewController: UIViewController {
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
topCardView
.
detail
View
=
detailLabel
topCardView
.
content
View
=
detailLabel
// Yes button.
let
btn1
:
FlatButton
=
FlatButton
()
...
...
@@ -91,7 +91,7 @@ class ViewController: UIViewController {
let
detailLabel
:
UILabel
=
UILabel
()
detailLabel
.
text
=
"It’s been a while, have you read any new books lately?"
detailLabel
.
numberOfLines
=
0
bottomCardView
.
detail
View
=
detailLabel
bottomCardView
.
content
View
=
detailLabel
// Yes button.
let
btn1
:
FlatButton
=
FlatButton
()
...
...
Sources/iOS/CardView.swift
View file @
4dbaa51d
...
...
@@ -119,29 +119,29 @@ public class CardView : MaterialPulseView {
}
/**
:name:
detail
ViewInsets
:name:
content
ViewInsets
*/
public
var
detail
ViewInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
public
var
content
ViewInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
detailViewInset
=
MaterialEdgeInsetToValue
(
detail
ViewInsetPreset
)
contentViewInset
=
MaterialEdgeInsetToValue
(
content
ViewInsetPreset
)
}
}
/**
:name:
detail
ViewInset
:name:
content
ViewInset
*/
@IBInspectable
public
var
detail
ViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
content
ViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
}
/**
:name:
detail
View
:name:
content
View
*/
@IBInspectable
public
var
detail
View
:
UIView
?
{
@IBInspectable
public
var
content
View
:
UIView
?
{
didSet
{
detail
View
?
.
translatesAutoresizingMaskIntoConstraints
=
false
content
View
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
}
}
...
...
@@ -234,9 +234,9 @@ public class CardView : MaterialPulseView {
/**
:name: init
*/
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
detail
View
:
UIView
?
=
nil
,
leftButtons
:
Array
<
UIButton
>
?
=
nil
,
rightButtons
:
Array
<
UIButton
>
?
=
nil
)
{
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
content
View
:
UIView
?
=
nil
,
leftButtons
:
Array
<
UIButton
>
?
=
nil
,
rightButtons
:
Array
<
UIButton
>
?
=
nil
)
{
self
.
init
(
frame
:
CGRectZero
)
prepareProperties
(
image
,
titleLabel
:
titleLabel
,
detailView
:
detail
View
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
prepareProperties
(
image
,
titleLabel
:
titleLabel
,
contentView
:
content
View
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
}
/**
...
...
@@ -279,9 +279,9 @@ public class CardView : MaterialPulseView {
if
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInset
.
top
+
titleLabelInset
.
top
}
else
if
nil
!=
detail
View
{
}
else
if
nil
!=
content
View
{
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInset
.
top
+
detail
ViewInset
.
top
metrics
[
"insetTop"
]
=
contentInset
.
top
+
content
ViewInset
.
top
}
// title
...
...
@@ -295,20 +295,20 @@ public class CardView : MaterialPulseView {
}
// detail
if
let
v
:
UIView
=
detail
View
{
if
let
v
:
UIView
=
content
View
{
addSubview
(
v
)
if
nil
==
titleLabel
{
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
detail
ViewInset
.
top
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
content
ViewInset
.
top
}
else
{
verticalFormat
+=
"-(insetB)"
metrics
[
"insetB"
]
=
titleLabelInset
.
bottom
+
detail
ViewInset
.
top
metrics
[
"insetB"
]
=
titleLabelInset
.
bottom
+
content
ViewInset
.
top
}
verticalFormat
+=
"-[
detail
View]"
views
[
"
detail
View"
]
=
v
verticalFormat
+=
"-[
content
View]"
views
[
"
content
View"
]
=
v
MaterialLayout
.
alignToParentHorizontally
(
self
,
child
:
v
,
left
:
contentInset
.
left
+
detailViewInset
.
left
,
right
:
contentInset
.
right
+
detail
ViewInset
.
right
)
MaterialLayout
.
alignToParentHorizontally
(
self
,
child
:
v
,
left
:
contentInset
.
left
+
contentViewInset
.
left
,
right
:
contentInset
.
right
+
content
ViewInset
.
right
)
}
// leftButtons
...
...
@@ -382,11 +382,11 @@ public class CardView : MaterialPulseView {
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
rightButtonsInset
.
bottom
}
if
nil
!=
detail
View
{
if
nil
!=
content
View
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
detail
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
content
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detail
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
content
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
}
else
if
nil
!=
titleLabel
{
if
nil
==
metrics
[
"insetC"
]
{
...
...
@@ -430,10 +430,10 @@ public class CardView : MaterialPulseView {
/**
:name: prepareProperties
*/
internal
func
prepareProperties
(
image
:
UIImage
?,
titleLabel
:
UILabel
?,
detail
View
:
UIView
?,
leftButtons
:
Array
<
UIButton
>
?,
rightButtons
:
Array
<
UIButton
>
?)
{
internal
func
prepareProperties
(
image
:
UIImage
?,
titleLabel
:
UILabel
?,
content
View
:
UIView
?,
leftButtons
:
Array
<
UIButton
>
?,
rightButtons
:
Array
<
UIButton
>
?)
{
self
.
image
=
image
self
.
titleLabel
=
titleLabel
self
.
detailView
=
detail
View
self
.
contentView
=
content
View
self
.
leftButtons
=
leftButtons
self
.
rightButtons
=
rightButtons
}
...
...
Sources/iOS/ControlView.swift
View file @
4dbaa51d
...
...
@@ -196,12 +196,6 @@ public class ControlView : MaterialView {
prepareContentView
()
}
/// Prepares the contentView.
public
func
prepareContentView
()
{
contentView
.
backgroundColor
=
nil
addSubview
(
contentView
)
}
/**
Used to trigger property changes that initializers avoid.
- Parameter leftControls: An Array of UIControls that go on the left side.
...
...
@@ -211,4 +205,10 @@ public class ControlView : MaterialView {
self
.
leftControls
=
leftControls
self
.
rightControls
=
rightControls
}
/// Prepares the contentView.
private
func
prepareContentView
()
{
contentView
.
backgroundColor
=
nil
addSubview
(
contentView
)
}
}
Sources/iOS/ImageCardView.swift
View file @
4dbaa51d
...
...
@@ -212,29 +212,29 @@ public class ImageCardView : MaterialPulseView {
}
/**
:name:
detail
ViewInsets
:name:
content
ViewInsets
*/
public
var
detail
ViewInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
public
var
content
ViewInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
detailViewInset
=
MaterialEdgeInsetToValue
(
detail
ViewInsetPreset
)
contentViewInset
=
MaterialEdgeInsetToValue
(
content
ViewInsetPreset
)
}
}
/**
:name:
detail
ViewInset
:name:
content
ViewInset
*/
@IBInspectable
public
var
detail
ViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
@IBInspectable
public
var
content
ViewInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
Square2
)
{
didSet
{
reloadView
()
}
}
/**
:name:
detail
View
:name:
content
View
*/
@IBInspectable
public
var
detail
View
:
UIView
?
{
@IBInspectable
public
var
content
View
:
UIView
?
{
didSet
{
detail
View
?
.
translatesAutoresizingMaskIntoConstraints
=
false
content
View
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
}
}
...
...
@@ -327,9 +327,9 @@ public class ImageCardView : MaterialPulseView {
/**
:name: init
*/
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
detail
View
:
UIView
?
=
nil
,
leftButtons
:
Array
<
UIButton
>
?
=
nil
,
rightButtons
:
Array
<
UIButton
>
?
=
nil
)
{
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
content
View
:
UIView
?
=
nil
,
leftButtons
:
Array
<
UIButton
>
?
=
nil
,
rightButtons
:
Array
<
UIButton
>
?
=
nil
)
{
self
.
init
(
frame
:
CGRectZero
)
prepareProperties
(
image
,
titleLabel
:
titleLabel
,
detailView
:
detail
View
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
prepareProperties
(
image
,
titleLabel
:
titleLabel
,
contentView
:
content
View
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
}
/**
...
...
@@ -379,9 +379,9 @@ public class ImageCardView : MaterialPulseView {
}
else
if
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInset
.
top
+
titleLabelInset
.
top
}
else
if
nil
!=
detail
View
{
}
else
if
nil
!=
content
View
{
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInset
.
top
+
detail
ViewInset
.
top
metrics
[
"insetTop"
]
=
contentInset
.
top
+
content
ViewInset
.
top
}
// title
...
...
@@ -398,20 +398,20 @@ public class ImageCardView : MaterialPulseView {
}
// detail
if
let
v
:
UIView
=
detail
View
{
if
let
v
:
UIView
=
content
View
{
addSubview
(
v
)
if
nil
==
imageLayer
?
.
contents
&&
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetB)"
metrics
[
"insetB"
]
=
titleLabelInset
.
bottom
+
detail
ViewInset
.
top
metrics
[
"insetB"
]
=
titleLabelInset
.
bottom
+
content
ViewInset
.
top
}
else
{
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
detail
ViewInset
.
top
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
content
ViewInset
.
top
}
verticalFormat
+=
"-[
detail
View]"
views
[
"
detail
View"
]
=
v
verticalFormat
+=
"-[
content
View]"
views
[
"
content
View"
]
=
v
MaterialLayout
.
alignToParentHorizontally
(
self
,
child
:
v
,
left
:
contentInset
.
left
+
detailViewInset
.
left
,
right
:
contentInset
.
right
+
detail
ViewInset
.
right
)
MaterialLayout
.
alignToParentHorizontally
(
self
,
child
:
v
,
left
:
contentInset
.
left
+
contentViewInset
.
left
,
right
:
contentInset
.
right
+
content
ViewInset
.
right
)
}
// leftButtons
...
...
@@ -486,11 +486,11 @@ public class ImageCardView : MaterialPulseView {
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
rightButtonsInset
.
bottom
}
if
nil
!=
detail
View
{
if
nil
!=
content
View
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
detail
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
content
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detail
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
content
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
}
else
if
nil
!=
titleLabel
{
if
nil
==
metrics
[
"insetC"
]
{
...
...
@@ -501,7 +501,7 @@ public class ImageCardView : MaterialPulseView {
}
else
if
nil
!=
metrics
[
"insetC"
]
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInset
.
top
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
}
else
if
nil
!=
detail
View
{
}
else
if
nil
!=
content
View
{
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
leftButtons
!
[
0
]
...
...
@@ -515,9 +515,9 @@ public class ImageCardView : MaterialPulseView {
}
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
detail
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInset
.
bottom
+
content
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detail
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
content
ViewInset
.
bottom
+
(
divider
?
dividerInset
.
top
+
dividerInset
.
bottom
:
0
)
}
}
else
{
if
0
<
leftButtons
?
.
count
{
...
...
@@ -583,10 +583,10 @@ public class ImageCardView : MaterialPulseView {
/**
:name: prepareProperties
*/
internal
func
prepareProperties
(
image
:
UIImage
?,
titleLabel
:
UILabel
?,
detail
View
:
UIView
?,
leftButtons
:
Array
<
UIButton
>
?,
rightButtons
:
Array
<
UIButton
>
?)
{
internal
func
prepareProperties
(
image
:
UIImage
?,
titleLabel
:
UILabel
?,
content
View
:
UIView
?,
leftButtons
:
Array
<
UIButton
>
?,
rightButtons
:
Array
<
UIButton
>
?)
{
self
.
image
=
image
self
.
titleLabel
=
titleLabel
self
.
detailView
=
detail
View
self
.
contentView
=
content
View
self
.
leftButtons
=
leftButtons
self
.
rightButtons
=
rightButtons
}
...
...
Sources/iOS/MaterialButton.swift
View file @
4dbaa51d
...
...
@@ -349,6 +349,10 @@ public class MaterialButton : UIButton {
}
}
public
override
func
alignmentRectInsets
()
->
UIEdgeInsets
{
return
UIEdgeInsetsZero
}
/**
A method that accepts CAAnimation objects and executes them on the
view's backing layer.
...
...
Sources/iOS/NavigationBar.swift
View file @
4dbaa51d
...
...
@@ -44,17 +44,38 @@ public extension UINavigationBar {
@IBDesignable
public
class
NavigationBar
:
UINavigationBar
{
/// The current layout.
private
var
isLandscape
:
Bool
=
false
/// Will render the view.
public
var
willRenderView
:
Bool
{
return
0
<
width
}
/// the spacer inset value.
private
var
spacerInset
:
CGFloat
=
0
/// A preset wrapper around contentInset.
public
var
contentInsetPreset
:
MaterialEdgeInset
=
.
None
{
didSet
{
contentInset
=
MaterialEdgeInsetToValue
(
contentInsetPreset
)
}
}
/// Left spacer moves the items to the left edge of the NavigationBar.
private
var
leftSpacer
:
UIBarButtonItem
=
UIBarButtonItem
(
barButtonSystemItem
:
.
FixedSpace
,
target
:
nil
,
action
:
nil
)
/// A wrapper around grid.contentInset.
@IBInspectable
public
var
contentInset
:
UIEdgeInsets
=
UIEdgeInsetsZero
{
didSet
{
layoutSubviews
()
}
}
/// Right spacer moves the items to the right edge of the NavigationBar.
private
var
rightSpacer
:
UIBarButtonItem
=
UIBarButtonItem
(
barButtonSystemItem
:
.
FixedSpace
,
target
:
nil
,
action
:
nil
)
/// A preset wrapper around spacing.
public
var
spacingPreset
:
MaterialSpacing
=
.
None
{
didSet
{
spacing
=
MaterialSpacingToValue
(
spacingPreset
)
}
}
/// A wrapper around grid.spacing.
@IBInspectable
public
var
spacing
:
CGFloat
=
0
{
didSet
{
layoutSubviews
()
}
}
/// Reference to the backButton.
public
private(set)
lazy
var
backButton
:
IconButton
=
IconButton
()
...
...
@@ -76,20 +97,6 @@ public class NavigationBar : UINavigationBar {
}
}
/// A preset for contentInset.
public
var
contentInsetPreset
:
MaterialEdgeInset
=
.
None
{
didSet
{
contentInset
=
MaterialEdgeInsetToValue
(
contentInsetPreset
)
}
}
/// A UIEdgeInsets value for insetting the content.
public
var
contentInset
:
UIEdgeInsets
=
MaterialEdgeInsetToValue
(
.
None
)
{
didSet
{
layoutSubviews
()
}
}
/**
This property is the same as clipsToBounds. It crops any of the view's
contents from bleeding past the view's frame. If an image is set using
...
...
@@ -265,31 +272,22 @@ public class NavigationBar : UINavigationBar {
self
.
init
(
frame
:
CGRectZero
)
}
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
public
override
func
intrinsicContentSize
()
->
CGSize
{
return
CGSizeMake
(
MaterialDevice
.
width
,
44
)
}
if
!
isLandscape
&&
MaterialDevice
.
isLandscape
{
isLandscape
=
true
spacerInset
=
0
}
else
if
isLandscape
&&
MaterialDevice
.
isPortrait
{
isLandscape
=
false
spacerInset
=
0
public
override
func
sizeThatFits
(
size
:
CGSize
)
->
CGSize
{
return
intrinsicContentSize
()
}
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
if
let
v
:
UINavigationItem
=
topItem
{
if
0
==
spacerInset
{
layoutNavigationItem
(
v
)
}
else
{
sizeNavigationItem
(
v
)
}
}
if
let
v
:
UINavigationItem
=
backItem
{
if
0
==
spacerInset
{
layoutNavigationItem
(
v
)
}
else
{
sizeNavigationItem
(
v
)
}
}
}
...
...
@@ -303,133 +301,103 @@ public class NavigationBar : UINavigationBar {
- Parameter item: A UINavigationItem to layout.
*/
internal
func
layoutNavigationItem
(
item
:
UINavigationItem
)
{
prepareItem
(
item
)
// leftControls
if
let
v
:
Array
<
UIControl
>
=
item
.
leftControls
{
if
0
<
v
.
count
{
var
n
:
Array
<
UIBarButtonItem
>
=
Array
<
UIBarButtonItem
>
()
for
c
in
v
{
n
.
append
(
UIBarButtonItem
(
customView
:
c
))
}
n
.
append
(
leftSpacer
)
item
.
leftBarButtonItems
=
n
.
reverse
()
if
0
==
spacerInset
{
spacerInset
=
n
.
first
!.
customView
!.
frame
.
origin
.
x
}
}
}
// Set the titleView if title is empty.
if
""
==
item
.
title
{
if
willRenderView
{
if
nil
==
item
.
titleView
{
item
.
titleView
=
UIView
(
frame
:
CGRectMake
(
0
,
contentInset
.
top
,
MaterialDevice
.
width
<
MaterialDevice
.
height
?
MaterialDevice
.
height
:
MaterialDevice
.
width
,
intrinsicContentSize
()
.
height
-
contentInset
.
top
-
contentInset
.
bottom
))
item
.
titleView
!.
grid
.
axis
.
direction
=
.
Vertical
item
.
titleView
=
UIView
(
frame
:
CGRectZero
)
}
// TitleView alignment.
if
let
t
:
UILabel
=
item
.
titleLabel
{
t
.
grid
.
rows
=
1
item
.
titleView
!.
addSubview
(
t
)
if
let
titleView
:
UIView
=
item
.
titleView
{
titleView
.
frame
.
origin
=
CGPointZero
t
itleView
.
frame
.
size
=
intrinsicContentSize
()
titleView
.
grid
.
axis
.
columns
=
Int
(
width
/
48
)
if
let
d
:
UILabel
=
item
.
detailLabel
{
d
.
grid
.
rows
=
1
item
.
titleView
!.
addSubview
(
d
)
item
.
titleView
!.
grid
.
views
=
[
t
,
d
]
}
else
{
item
.
titleView
!.
grid
.
views
=
[
t
]
}
}
else
if
let
d
:
UIView
=
item
.
detailView
{
d
.
grid
.
rows
=
1
item
.
titleView
!.
addSubview
(
d
)
item
.
titleView
!.
grid
.
views
=
[
d
]
}
if
nil
==
item
.
contentView
{
item
.
contentView
=
UIView
()
}
// rightControls
if
let
v
:
Array
<
UIControl
>
=
item
.
rightControls
{
if
0
<
v
.
count
{
var
n
:
Array
<
UIBarButtonItem
>
=
Array
<
UIBarButtonItem
>
()
for
c
in
v
{
n
.
append
(
UIBarButtonItem
(
customView
:
c
))
}
if
let
contentView
:
UIView
=
item
.
contentView
{
contentView
.
grid
.
columns
=
titleView
.
grid
.
axis
.
columns
n
.
append
(
rightSpacer
)
item
.
rightBarButtonItems
=
n
.
reverse
()
if
0
==
spacerInset
{
spacerInset
=
width
-
n
[
n
.
count
-
2
]
.
customView
!.
frame
.
origin
.
x
-
n
[
n
.
count
-
2
]
.
customView
!.
frame
.
width
}
// Size of single grid column.
if
let
g
:
CGFloat
=
width
/
CGFloat
(
0
<
titleView
.
grid
.
axis
.
columns
?
titleView
.
grid
.
axis
.
columns
:
1
)
{
titleView
.
grid
.
views
=
[]
// leftControls
if
let
v
:
Array
<
UIControl
>
=
item
.
leftControls
{
for
c
in
v
{
let
w
:
CGFloat
=
c
.
intrinsicContentSize
()
.
width
if
let
b
:
UIButton
=
c
as?
UIButton
{
b
.
contentEdgeInsets
=
UIEdgeInsetsZero
}
c
.
frame
.
size
.
height
=
titleView
.
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
grid
.
columns
=
0
==
g
?
1
:
Int
(
ceil
(
w
/
g
))
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
titleView
.
addSubview
(
c
)
titleView
.
grid
.
views
?
.
append
(
c
)
}
sizeNavigationItem
(
item
)
}
/**
Sizes the UINavigationItem.
- Parameter item: A UINavigationItem to size.
*/
internal
func
sizeNavigationItem
(
item
:
UINavigationItem
)
{
print
(
spacerInset
)
let
h
:
CGFloat
=
intrinsicContentSize
()
.
height
var
spaceLeft
:
CGFloat
=
0
var
spaceRight
:
CGFloat
=
0
var
capturedSpace
:
Bool
=
false
titleView
.
addSubview
(
contentView
)
titleView
.
grid
.
views
?
.
append
(
contentView
)
// lef
tControls
if
let
v
:
Array
<
UIControl
>
=
item
.
lef
tControls
{
// righ
tControls
if
let
v
:
Array
<
UIControl
>
=
item
.
righ
tControls
{
for
c
in
v
{
let
w
:
CGFloat
=
c
.
intrinsicContentSize
()
.
width
if
let
b
:
UIButton
=
c
as?
UIButton
{
b
.
contentEdgeInsets
.
top
=
0
b
.
contentEdgeInsets
.
bottom
=
0
b
.
contentEdgeInsets
=
UIEdgeInsetsZero
}
c
.
frame
.
size
.
height
=
titleView
.
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
grid
.
columns
=
0
==
g
?
1
:
Int
(
ceil
(
w
/
g
))
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
titleView
.
addSubview
(
c
)
titleView
.
grid
.
views
?
.
append
(
c
)
}
c
.
bounds
.
size
=
CGSizeMake
(
c
.
intrinsicContentSize
()
.
width
,
h
-
contentInset
.
top
-
contentInset
.
bottom
)
c
.
backgroundColor
=
MaterialColor
.
purple
.
base
spaceLeft
+=
c
.
bounds
.
size
.
width
+
contentInset
.
left
}
leftSpacer
.
width
=
contentInset
.
left
-
spacerInset
spaceLeft
+=
contentInset
.
left
}
item
.
titleView
?
.
frame
.
size
.
width
=
width
item
.
titleView
?
.
frame
.
size
.
height
=
height
-
contentInset
.
top
-
contentInset
.
bottom
contentView
.
grid
.
views
=
[]
// contentView alignment.
if
let
title
:
String
=
item
.
title
{
if
let
t
:
UILabel
=
item
.
titleLabel
{
if
32
>=
height
||
nil
==
item
.
detailLabel
{
t
.
font
=
t
.
font
.
fontWithSize
(
20
)
if
""
!=
title
{
t
.
text
=
title
}
item
.
title
=
""
if
""
!=
t
.
text
{
t
.
grid
.
rows
=
1
contentView
.
addSubview
(
t
)
contentView
.
grid
.
views
?
.
append
(
t
)
item
.
detailLabel
?
.
hidden
=
true
item
.
titleView
?
.
grid
.
axis
.
rows
=
1
}
else
if
let
d
:
UILabel
=
item
.
detailLabel
{
if
let
detail
:
String
=
item
.
detail
{
if
let
d
:
UILabel
=
item
.
detailLabel
{
t
.
font
=
t
.
font
.
fontWithSize
(
17
)
d
.
hidden
=
false
d
.
text
=
detail
d
.
grid
.
rows
=
1
d
.
font
=
d
.
font
.
fontWithSize
(
12
)
item
.
titleView
?
.
grid
.
axis
.
rows
=
2
contentView
.
addSubview
(
d
)
contentView
.
grid
.
axis
.
rows
=
2
contentView
.
grid
.
views
?
.
append
(
d
)
}
}
else
if
let
_
:
UIView
=
item
.
detailView
{
item
.
titleView
?
.
grid
.
axis
.
rows
=
1
}
else
{
t
.
font
=
t
.
font
?
.
fontWithSize
(
20
)
contentView
.
grid
.
axis
.
rows
=
1
}
// rightControls
if
let
v
:
Array
<
UIControl
>
=
item
.
rightControls
{
for
c
in
v
{
if
let
b
:
UIButton
=
c
as?
UIButton
{
b
.
contentEdgeInsets
.
top
=
0
b
.
contentEdgeInsets
.
bottom
=
0
}
c
.
bounds
.
size
=
CGSizeMake
(
c
.
intrinsicContentSize
()
.
width
,
h
-
contentInset
.
top
-
contentInset
.
bottom
)
c
.
backgroundColor
=
MaterialColor
.
purple
.
base
.
colorWithAlphaComponent
(
0.1
)
spaceRight
+=
c
.
bounds
.
size
.
width
+
contentInset
.
right
}
rightSpacer
.
width
=
contentInset
.
right
-
spacerInset
spaceRight
+=
contentInset
.
right
}
item
.
titleView
?
.
backgroundColor
=
MaterialColor
.
green
.
base
item
.
titleView
?
.
frame
.
size
.
width
=
width
-
spaceLeft
-
spaceRight
item
.
titleView
?
.
frame
.
origin
.
x
=
spaceLeft
item
.
titleView
?
.
grid
.
reloadLayout
()
titleView
.
grid
.
contentInset
=
contentInset
titleView
.
grid
.
spacing
=
spacing
titleView
.
grid
.
reloadLayout
()
contentView
.
grid
.
axis
.
direction
=
.
Vertical
contentView
.
grid
.
reloadLayout
()
}
}
}
}
/**
...
...
@@ -440,28 +408,23 @@ public class NavigationBar : UINavigationBar {
when subclassing.
*/
public
func
prepareView
()
{
isLandscape
=
MaterialDevice
.
isLandscape
barStyle
=
.
Default
translucent
=
false
backButtonImage
=
nil
backgroundColor
=
MaterialColor
.
white
depth
=
.
Depth1
spacingPreset
=
.
Spacing1
contentInsetPreset
=
.
Square1
contentScaleFactor
=
MaterialDevice
.
scale
prepareBackButton
()
}
/// Prepares the backButton.
internal
func
prepareBackButton
()
{
private
func
prepareBackButton
()
{
backButton
.
pulseColor
=
MaterialColor
.
white
backButton
.
setImage
(
backButtonImage
,
forState
:
.
Normal
)
backButton
.
setImage
(
backButtonImage
,
forState
:
.
Highlighted
)
}
/// Prepares the UINavigationItem for layout and sizing.
internal
func
prepareItem
(
item
:
UINavigationItem
)
{
if
nil
==
item
.
title
{
item
.
title
=
""
}
backButtonImage
=
nil
let
image
:
UIImage
?
=
UIImage
.
imageWithColor
(
MaterialColor
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
shadowImage
=
image
setBackgroundImage
(
image
,
forBarMetrics
:
.
Default
)
}
}
Sources/iOS/NavigationController.swift
View file @
4dbaa51d
...
...
@@ -114,7 +114,7 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
*/
public
func
navigationBar
(
navigationBar
:
UINavigationBar
,
shouldPushItem
item
:
UINavigationItem
)
->
Bool
{
if
let
v
:
NavigationBar
=
navigationBar
as?
NavigationBar
{
item
.
setHidesBackButton
(
true
,
animated
:
false
)
item
.
hidesBackButton
=
true
if
var
c
:
Array
<
UIControl
>
=
item
.
leftControls
{
c
.
append
(
v
.
backButton
)
item
.
leftControls
=
c
...
...
Sources/iOS/NavigationItem.swift
View file @
4dbaa51d
...
...
@@ -35,19 +35,27 @@ private var MaterialAssociatedObjectNavigationItemKey: UInt8 = 0
public
class
MaterialAssociatedObjectNavigationItem
{
/// Detail View.
public
var
detail
View
:
UIView
?
public
var
content
View
:
UIView
?
/// Title label.
public
var
titleLabel
:
UILabel
?
public
var
titleLabel
:
UILabel
/// Detail text.
public
var
detail
:
String
?
/// Detail label.
public
var
detailLabel
:
UILabel
?
public
var
detailLabel
:
UILabel
/// Left controls.
public
var
leftControls
:
Array
<
UIControl
>
?
/// Right controls.
public
var
rightControls
:
Array
<
UIControl
>
?
public
init
()
{
titleLabel
=
UILabel
()
detailLabel
=
UILabel
()
}
}
public
extension
UINavigationItem
{
...
...
@@ -64,17 +72,17 @@ public extension UINavigationItem {
}
/// Detail View.
public
var
detail
View
:
UIView
?
{
public
internal(set)
var
content
View
:
UIView
?
{
get
{
return
item
.
detail
View
return
item
.
content
View
}
set
(
value
)
{
item
.
detail
View
=
value
item
.
content
View
=
value
}
}
/// Title Label.
public
var
titleLabel
:
UILabel
?
{
public
internal(set)
var
titleLabel
:
UILabel
{
get
{
return
item
.
titleLabel
}
...
...
@@ -83,8 +91,18 @@ public extension UINavigationItem {
}
}
/// Detail text.
public
var
detail
:
String
?
{
get
{
return
item
.
detail
}
set
(
value
)
{
item
.
detail
=
value
}
}
/// Detail Label.
public
var
detailLabel
:
UILabel
?
{
public
internal(set)
var
detailLabel
:
UILabel
{
get
{
return
item
.
detailLabel
}
...
...
Sources/iOS/SearchBar.swift
View file @
4dbaa51d
...
...
@@ -99,9 +99,15 @@ public class SearchBar : StatusBarView {
}
}
/// Prepares the contentView.
public
override
func
prepareContentView
()
{
super
.
prepareContentView
()
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
prepareTextField
()
prepareClearButton
()
}
...
...
Sources/iOS/StatusBarView.swift
View file @
4dbaa51d
...
...
@@ -74,7 +74,7 @@ public class StatusBarView : ControlView {
width
=
MaterialDevice
.
width
}
grid
.
axis
.
columns
=
Int
(
width
/
56
)
grid
.
axis
.
columns
=
Int
(
width
/
48
)
// General alignment.
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
isLandscape
{
...
...
Sources/iOS/Toolbar.swift
View file @
4dbaa51d
...
...
@@ -101,9 +101,15 @@ public class Toolbar : StatusBarView {
}
}
/// Prepares the contentView.
public
override
func
prepareContentView
()
{
super
.
prepareContentView
()
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
contentView
.
grid
.
axis
.
direction
=
.
Vertical
}
...
...
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