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
d52f210d
Commit
d52f210d
authored
Aug 01, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated NavigationItem to reload the NavigationBar subviews when the title or detail values change
parent
c1d5dff6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Sources/iOS/NavigationItem.swift
+12
-12
No files found.
Sources/iOS/NavigationItem.swift
View file @
d52f210d
...
@@ -64,6 +64,14 @@ public class MaterialAssociatedObjectNavigationItem {
...
@@ -64,6 +64,14 @@ public class MaterialAssociatedObjectNavigationItem {
prepareDetailLabel
()
prepareDetailLabel
()
}
}
/// Reloads the subviews for the NavigationBar.
internal
func
reloadNavigationBar
()
{
guard
let
navigationBar
=
contentView
?
.
superview
?
.
superview
as?
NavigationBar
else
{
return
}
navigationBar
.
layoutSubviews
()
}
/// Prepares the titleLabel.
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
private
func
prepareTitleLabel
()
{
titleLabel
=
UILabel
()
titleLabel
=
UILabel
()
...
@@ -119,18 +127,14 @@ public extension UINavigationItem {
...
@@ -119,18 +127,14 @@ public extension UINavigationItem {
}
}
set
(
value
)
{
set
(
value
)
{
titleLabel
.
text
=
value
titleLabel
.
text
=
value
item
.
reloadNavigationBar
()
}
}
}
}
/// Title Label.
/// Title Label.
public
internal(set)
var
titleLabel
:
UILabel
{
public
var
titleLabel
:
UILabel
{
get
{
return
item
.
titleLabel
return
item
.
titleLabel
}
}
set
(
value
)
{
item
.
titleLabel
=
value
}
}
/// Detail text.
/// Detail text.
public
var
detail
:
String
?
{
public
var
detail
:
String
?
{
...
@@ -139,18 +143,14 @@ public extension UINavigationItem {
...
@@ -139,18 +143,14 @@ public extension UINavigationItem {
}
}
set
(
value
)
{
set
(
value
)
{
detailLabel
.
text
=
value
detailLabel
.
text
=
value
item
.
reloadNavigationBar
()
}
}
}
}
/// Detail Label.
/// Detail Label.
public
internal(set)
var
detailLabel
:
UILabel
{
public
var
detailLabel
:
UILabel
{
get
{
return
item
.
detailLabel
return
item
.
detailLabel
}
}
set
(
value
)
{
item
.
detailLabel
=
value
}
}
/// Left side UIControls.
/// Left side UIControls.
public
var
leftControls
:
Array
<
UIControl
>
?
{
public
var
leftControls
:
Array
<
UIControl
>
?
{
...
...
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