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
0a873b75
Commit
0a873b75
authored
Sep 12, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for heightPreset in BottomNavigationController
parent
76e60ab6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
Sources/iOS/BottomNavigationController.swift
+22
-0
No files found.
Sources/iOS/BottomNavigationController.swift
View file @
0a873b75
...
@@ -41,6 +41,15 @@ extension UIViewController {
...
@@ -41,6 +41,15 @@ extension UIViewController {
}
}
}
}
private
class
MaterialTabBar
:
UITabBar
{
override
func
sizeThatFits
(
_
size
:
CGSize
)
->
CGSize
{
var
v
=
super
.
sizeThatFits
(
size
)
let
offset
=
v
.
height
-
49
v
.
height
=
CGFloat
(
heightPreset
.
rawValue
)
+
offset
return
v
}
}
open
class
BottomNavigationController
:
UITabBarController
{
open
class
BottomNavigationController
:
UITabBarController
{
/// A Boolean that indicates if the swipe feature is enabled..
/// A Boolean that indicates if the swipe feature is enabled..
open
var
isSwipeEnabled
=
false
{
open
var
isSwipeEnabled
=
false
{
...
@@ -60,6 +69,7 @@ open class BottomNavigationController: UITabBarController {
...
@@ -60,6 +69,7 @@ open class BottomNavigationController: UITabBarController {
*/
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
super
.
init
(
coder
:
aDecoder
)
setTabBarClass
()
}
}
/**
/**
...
@@ -69,6 +79,7 @@ open class BottomNavigationController: UITabBarController {
...
@@ -69,6 +79,7 @@ open class BottomNavigationController: UITabBarController {
*/
*/
public
override
init
(
nibName
nibNameOrNil
:
String
?,
bundle
nibBundleOrNil
:
Bundle
?)
{
public
override
init
(
nibName
nibNameOrNil
:
String
?,
bundle
nibBundleOrNil
:
Bundle
?)
{
super
.
init
(
nibName
:
nibNameOrNil
,
bundle
:
nibBundleOrNil
)
super
.
init
(
nibName
:
nibNameOrNil
,
bundle
:
nibBundleOrNil
)
setTabBarClass
()
}
}
/// An initializer that accepts no parameters.
/// An initializer that accepts no parameters.
...
@@ -144,6 +155,17 @@ open class BottomNavigationController: UITabBarController {
...
@@ -144,6 +155,17 @@ open class BottomNavigationController: UITabBarController {
}
}
private
extension
BottomNavigationController
{
private
extension
BottomNavigationController
{
/// Sets tabBar class to MaterialTabBar.
func
setTabBarClass
()
{
guard
object_getClass
(
tabBar
)
===
UITabBar
.
self
else
{
return
}
object_setClass
(
tabBar
,
MaterialTabBar
.
self
)
}
}
private
extension
BottomNavigationController
{
/**
/**
Selects a view controller at a given index.
Selects a view controller at a given index.
- Parameter at index: An Int.
- Parameter at index: An Int.
...
...
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