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
fd0b041e
Unverified
Commit
fd0b041e
authored
Dec 20, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Toolbar title and detail to be @IBInspectable
parent
8d997a6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
Sources/iOS/Toolbar.swift
+22
-16
No files found.
Sources/iOS/Toolbar.swift
View file @
fd0b041e
...
@@ -33,8 +33,9 @@ import UIKit
...
@@ -33,8 +33,9 @@ import UIKit
private
var
ToolbarContext
:
UInt8
=
0
private
var
ToolbarContext
:
UInt8
=
0
open
class
Toolbar
:
Bar
{
open
class
Toolbar
:
Bar
{
/// A convenience property to set the titleLabel text.
/// A convenience property to set the titleLabel.text.
open
var
title
:
String
?
{
@IBInspectable
open
var
title
:
String
?
{
get
{
get
{
return
titleLabel
.
text
return
titleLabel
.
text
}
}
...
@@ -45,10 +46,12 @@ open class Toolbar: Bar {
...
@@ -45,10 +46,12 @@ open class Toolbar: Bar {
}
}
/// Title label.
/// Title label.
open
fileprivate
(
set
)
lazy
var
titleLabel
=
UILabel
()
@IBInspectable
open
let
titleLabel
=
UILabel
()
/// A convenience property to set the detailLabel text.
/// A convenience property to set the detailLabel.text.
open
var
detail
:
String
?
{
@IBInspectable
open
var
detail
:
String
?
{
get
{
get
{
return
detailLabel
.
text
return
detailLabel
.
text
}
}
...
@@ -59,7 +62,8 @@ open class Toolbar: Bar {
...
@@ -59,7 +62,8 @@ open class Toolbar: Bar {
}
}
/// Detail label.
/// Detail label.
open
fileprivate
(
set
)
lazy
var
detailLabel
=
UILabel
()
@IBInspectable
open
let
detailLabel
=
UILabel
()
deinit
{
deinit
{
removeObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
)
removeObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
)
...
@@ -142,21 +146,23 @@ open class Toolbar: Bar {
...
@@ -142,21 +146,23 @@ open class Toolbar: Bar {
prepareTitleLabel
()
prepareTitleLabel
()
prepareDetailLabel
()
prepareDetailLabel
()
}
}
}
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
extension
Toolbar
{
/// Prepares the titleLabel.
fileprivate
func
prepareTitleLabel
()
{
titleLabel
.
textAlignment
=
.
center
titleLabel
.
textAlignment
=
.
center
titleLabel
.
contentScaleFactor
=
Screen
.
scale
titleLabel
.
contentScaleFactor
=
Screen
.
scale
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
textColor
=
Color
.
darkText
.
primary
titleLabel
.
textColor
=
Color
.
darkText
.
primary
addObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
,
options
:
[],
context
:
&
ToolbarContext
)
addObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
,
options
:
[],
context
:
&
ToolbarContext
)
}
}
/// Prepares the detailLabel.
/// Prepares the detailLabel.
private
func
prepareDetailLabel
()
{
file
private
func
prepareDetailLabel
()
{
detailLabel
.
textAlignment
=
.
center
detailLabel
.
textAlignment
=
.
center
detailLabel
.
contentScaleFactor
=
Screen
.
scale
detailLabel
.
contentScaleFactor
=
Screen
.
scale
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
textColor
=
Color
.
darkText
.
secondary
detailLabel
.
textColor
=
Color
.
darkText
.
secondary
}
}
}
}
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