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
1b1e0712
Commit
1b1e0712
authored
Aug 22, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added Divider to BottomTabBar and BottomTabBarController
parent
cbac4b47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
36 deletions
+29
-36
Sources/iOS/BottomNavigationController.swift
+4
-2
Sources/iOS/BottomTabBar.swift
+17
-26
Sources/iOS/Divider.swift
+8
-8
No files found.
Sources/iOS/BottomNavigationController.swift
View file @
1b1e0712
...
@@ -60,7 +60,7 @@ public enum BottomNavigationTransitionAnimation: Int {
...
@@ -60,7 +60,7 @@ public enum BottomNavigationTransitionAnimation: Int {
}
}
@IBDesignable
@IBDesignable
open
class
BottomNavigationController
:
UITabBarController
,
UITabBarControllerDelegate
{
open
class
BottomNavigationController
:
UITabBarController
,
UITabBarControllerDelegate
{
/// The transition animation to use when selecting a new tab.
/// The transition animation to use when selecting a new tab.
open
var
transitionAnimation
:
BottomNavigationTransitionAnimation
=
.
fade
open
var
transitionAnimation
:
BottomNavigationTransitionAnimation
=
.
fade
...
@@ -96,7 +96,7 @@ open class BottomNavigationController : UITabBarController, UITabBarControllerDe
...
@@ -96,7 +96,7 @@ open class BottomNavigationController : UITabBarController, UITabBarControllerDe
}
}
open
func
layoutSubviews
()
{
open
func
layoutSubviews
()
{
if
let
v
:
Array
<
UITabBarItem
>
=
tabBar
.
items
{
if
let
v
=
tabBar
.
items
{
for
item
in
v
{
for
item
in
v
{
if
.
phone
==
Device
.
userInterfaceIdiom
{
if
.
phone
==
Device
.
userInterfaceIdiom
{
if
nil
==
item
.
title
{
if
nil
==
item
.
title
{
...
@@ -118,6 +118,8 @@ open class BottomNavigationController : UITabBarController, UITabBarControllerDe
...
@@ -118,6 +118,8 @@ open class BottomNavigationController : UITabBarController, UITabBarControllerDe
}
}
}
}
}
}
tabBar
.
divider
.
reload
()
}
}
/**
/**
...
...
Sources/iOS/BottomTabBar.swift
View file @
1b1e0712
...
@@ -39,7 +39,7 @@ extension UITabBarItem {
...
@@ -39,7 +39,7 @@ extension UITabBarItem {
@IBDesignable
@IBDesignable
open
class
BottomTabBar
:
UITabBar
{
open
class
BottomTabBar
:
UITabBar
{
/// Automatically aligns the BottomNavigationBar to the superview.
/// Automatically aligns the BottomNavigationBar to the superview.
open
var
isAlignedToParentAutomatically
=
true
open
var
isAlignedToParentAutomatically
=
true
/// A property that accesses the backing layer's backgroundColor.
/// A property that accesses the backing layer's backgroundColor.
...
@@ -81,6 +81,7 @@ open class BottomTabBar: UITabBar {
...
@@ -81,6 +81,7 @@ open class BottomTabBar: UITabBar {
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShadowPath
()
layoutShadowPath
()
if
let
v
=
items
{
if
let
v
=
items
{
for
item
in
v
{
for
item
in
v
{
if
.
phone
==
Device
.
userInterfaceIdiom
{
if
.
phone
==
Device
.
userInterfaceIdiom
{
...
@@ -101,6 +102,8 @@ open class BottomTabBar: UITabBar {
...
@@ -101,6 +102,8 @@ open class BottomTabBar: UITabBar {
}
}
}
}
}
}
divider
.
reload
()
}
}
open
override
func
didMoveToSuperview
()
{
open
override
func
didMoveToSuperview
()
{
...
@@ -130,31 +133,19 @@ open class BottomTabBar: UITabBar {
...
@@ -130,31 +133,19 @@ open class BottomTabBar: UITabBar {
}
}
/// A memory reference to the TabBarItem instance.
/// A memory reference to the TabBarItem instance.
private
var
MaterialAssociatedObjectTabBarKey
:
UInt8
=
0
private
var
TabBarKey
:
UInt8
=
0
public
class
MaterialAssociatedObjectTabBar
{
/**
A property that sets the shadowOffset, shadowOpacity, and shadowRadius
for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects.
*/
public
var
depthPreset
:
DepthPreset
public
init
(
depthPreset
:
DepthPreset
)
{
self
.
depthPreset
=
depthPreset
}
}
extension
UITabBar
{
extension
UITabBar
{
/// TabBarItem reference.
/// TabBarItem reference.
public
internal(set)
var
item
:
MaterialAssociatedObjectTabBar
{
public
internal(set)
var
divider
:
Divider
!
{
get
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
MaterialAssociatedObject
TabBarKey
)
{
return
AssociatedObject
(
base
:
self
,
key
:
&
TabBarKey
)
{
return
MaterialAssociatedObjectTabBar
(
depthPreset
:
.
none
)
return
Divider
(
view
:
self
)
}
}
}
}
set
(
value
)
{
set
(
value
)
{
AssociateObject
(
base
:
self
,
key
:
&
MaterialAssociatedObject
TabBarKey
,
value
:
value
)
AssociateObject
(
base
:
self
,
key
:
&
TabBarKey
,
value
:
value
)
}
}
}
}
}
}
Sources/iOS/Divider.swift
View file @
1b1e0712
...
@@ -42,12 +42,12 @@ open class Divider {
...
@@ -42,12 +42,12 @@ open class Divider {
/// A reference to the UIView.
/// A reference to the UIView.
internal
weak
var
view
:
UIView
?
internal
weak
var
view
:
UIView
?
/// A reference to the height.
internal
var
height
:
CGFloat
/// A reference to the divider UIView.
/// A reference to the divider UIView.
internal
var
line
:
UIView
?
internal
var
line
:
UIView
?
/// A reference to the height.
public
var
height
:
CGFloat
/// Divider color.
/// Divider color.
open
var
color
:
UIColor
?
{
open
var
color
:
UIColor
?
{
get
{
get
{
...
@@ -87,19 +87,19 @@ open class Divider {
...
@@ -87,19 +87,19 @@ open class Divider {
/// Lays out the divider.
/// Lays out the divider.
internal
func
reload
()
{
internal
func
reload
()
{
guard
let
v
=
view
else
{
guard
let
l
=
line
,
let
v
=
view
else
{
return
return
}
}
switch
alignment
{
switch
alignment
{
case
.
top
:
case
.
top
:
l
ine
?
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
v
.
width
,
height
:
height
)
l
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
v
.
width
,
height
:
height
)
case
.
bottom
:
case
.
bottom
:
l
ine
?
.
frame
=
CGRect
(
x
:
0
,
y
:
v
.
height
-
height
,
width
:
v
.
width
,
height
:
height
)
l
.
frame
=
CGRect
(
x
:
0
,
y
:
v
.
height
-
height
,
width
:
v
.
width
,
height
:
height
)
case
.
left
:
case
.
left
:
l
ine
?
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
height
,
height
:
v
.
height
)
l
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
height
,
height
:
v
.
height
)
case
.
right
:
case
.
right
:
l
ine
?
.
frame
=
CGRect
(
x
:
v
.
width
-
height
,
y
:
0
,
width
:
height
,
height
:
v
.
height
)
l
.
frame
=
CGRect
(
x
:
v
.
width
-
height
,
y
:
0
,
width
:
height
,
height
:
v
.
height
)
}
}
}
}
}
}
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