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
1af9a3a2
Commit
1af9a3a2
authored
Jun 06, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed hide tabBar issue with MenuController by rearranging the hierarchy
parent
0eaec94e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
56 deletions
+26
-56
Examples/Programmatic/App/App/AppDelegate.swift
+4
-5
Examples/Programmatic/App/App/AppMenuController.swift
+17
-18
Examples/Programmatic/App/App/AppNavigationController.swift
+0
-1
Examples/Programmatic/App/App/ItemViewController.swift
+4
-11
Examples/Programmatic/App/App/RecipesViewController.swift
+1
-21
No files found.
Examples/Programmatic/App/App/AppDelegate.swift
View file @
1af9a3a2
...
@@ -39,16 +39,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -39,16 +39,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
let
navigationController
:
AppNavigationController
=
AppNavigationController
(
rootViewController
:
RecipesViewController
())
let
navigationController
:
AppNavigationController
=
AppNavigationController
(
rootViewController
:
RecipesViewController
())
let
menuController
:
AppMenuController
=
AppMenuController
(
rootViewController
:
navigationController
)
menuController
.
edgesForExtendedLayout
=
.
None
let
bottomNavigationController
:
BottomNavigationController
=
BottomNavigationController
()
let
bottomNavigationController
:
BottomNavigationController
=
BottomNavigationController
()
bottomNavigationController
.
viewControllers
=
[
/*menuController*/
navigationController
,
VideoViewController
(),
PhotoViewController
()]
bottomNavigationController
.
viewControllers
=
[
navigationController
,
VideoViewController
(),
PhotoViewController
()]
bottomNavigationController
.
selectedIndex
=
0
bottomNavigationController
.
selectedIndex
=
0
bottomNavigationController
.
tabBar
.
tintColor
=
MaterialColor
.
white
bottomNavigationController
.
tabBar
.
tintColor
=
MaterialColor
.
white
bottomNavigationController
.
tabBar
.
backgroundColor
=
MaterialColor
.
grey
.
darken4
bottomNavigationController
.
tabBar
.
backgroundColor
=
MaterialColor
.
grey
.
darken4
let
sideNavigationController
:
SideNavigationController
=
SideNavigationController
(
rootViewController
:
bottomNavigationController
,
leftViewController
:
AppLeftViewController
())
let
menuController
:
AppMenuController
=
AppMenuController
(
rootViewController
:
bottomNavigationController
)
let
sideNavigationController
:
SideNavigationController
=
SideNavigationController
(
rootViewController
:
menuController
,
leftViewController
:
AppLeftViewController
())
sideNavigationController
.
statusBarStyle
=
.
LightContent
sideNavigationController
.
statusBarStyle
=
.
LightContent
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
...
...
Examples/Programmatic/App/App/AppMenuController.swift
View file @
1af9a3a2
...
@@ -40,27 +40,11 @@ class AppMenuController: MenuController {
...
@@ -40,27 +40,11 @@ class AppMenuController: MenuController {
/// MenuView diameter.
/// MenuView diameter.
private
let
baseSize
:
CGSize
=
CGSizeMake
(
56
,
56
)
private
let
baseSize
:
CGSize
=
CGSizeMake
(
56
,
56
)
/// MenuView inset.
private
let
menuViewInset
:
CGFloat
=
16
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
}
override
init
(
rootViewController
:
UIViewController
)
{
super
.
init
(
rootViewController
:
rootViewController
)
}
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
prepareMenuView
()
prepareMenuView
()
}
}
override
func
viewWillDisappear
(
animated
:
Bool
)
{
super
.
viewWillDisappear
(
animated
)
closeMenu
()
}
override
func
openMenu
(
completion
:
(()
->
Void
)?
=
nil
)
{
override
func
openMenu
(
completion
:
(()
->
Void
)?
=
nil
)
{
super
.
openMenu
(
completion
)
super
.
openMenu
(
completion
)
sideNavigationController
?
.
enabled
=
false
sideNavigationController
?
.
enabled
=
false
...
@@ -97,6 +81,22 @@ class AppMenuController: MenuController {
...
@@ -97,6 +81,22 @@ class AppMenuController: MenuController {
}
}
}
}
/// Shows the menuView.
func
showMenu
()
{
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
translateY
(
0
)
]))
}
/// Hides the menuView.
func
hideMenu
()
{
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
translateY
(
150
)
]))
}
/// Prepares the menuView.
/// Prepares the menuView.
private
func
prepareMenuView
()
{
private
func
prepareMenuView
()
{
var
image
:
UIImage
?
=
MaterialIcon
.
cm
.
add
var
image
:
UIImage
?
=
MaterialIcon
.
cm
.
add
...
@@ -140,9 +140,8 @@ class AppMenuController: MenuController {
...
@@ -140,9 +140,8 @@ class AppMenuController: MenuController {
menuView
.
delegate
=
self
menuView
.
delegate
=
self
view
.
layout
.
size
(
menuView
,
width
:
baseSize
.
width
,
height
:
baseSize
.
height
)
view
.
layout
.
size
(
menuView
,
width
:
baseSize
.
width
,
height
:
baseSize
.
height
)
view
.
layout
.
alignFromBottomRight
(
menuView
,
bottom
:
menuViewInset
,
right
:
menuViewInset
)
view
.
layout
.
alignFromBottomRight
(
menuView
,
bottom
:
65
,
right
:
16
)
}
}
}
}
/// MenuViewDelegate.
/// MenuViewDelegate.
...
...
Examples/Programmatic/App/App/AppNavigationController.swift
View file @
1af9a3a2
...
@@ -50,5 +50,4 @@ class AppNavigationController: NavigationController {
...
@@ -50,5 +50,4 @@ class AppNavigationController: NavigationController {
tabBarItem
.
setTitleColor
(
MaterialColor
.
grey
.
base
,
forState
:
.
Normal
)
tabBarItem
.
setTitleColor
(
MaterialColor
.
grey
.
base
,
forState
:
.
Normal
)
tabBarItem
.
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Selected
)
tabBarItem
.
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Selected
)
}
}
}
}
Examples/Programmatic/App/App/ItemViewController.swift
View file @
1af9a3a2
...
@@ -75,20 +75,13 @@ class ItemViewController: UIViewController {
...
@@ -75,20 +75,13 @@ class ItemViewController: UIViewController {
override
func
viewWillAppear
(
animated
:
Bool
)
{
override
func
viewWillAppear
(
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
super
.
viewWillAppear
(
animated
)
(
menuController
as?
AppMenuController
)?
.
hideMenu
()
sideNavigationController
?
.
enabled
=
false
sideNavigationController
?
.
enabled
=
false
// Stops the scrollView contentInsets from being automatically adjusted.
automaticallyAdjustsScrollViewInsets
=
false
// Customize the navigationItem.backButton image here.
// (navigationController?.navigationBar as? NavigationBar)?.backButtonImage = MaterialIcon.cm.audioLibrary
}
}
override
func
viewDidAppear
(
animated
:
Bool
)
{
override
func
viewWillDisappear
(
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
super
.
viewWillDisappear
(
animated
)
(
menuController
as?
AppMenuController
)?
.
showMenu
()
// Access the navigationItem.backButton here.
// navigationItem.backButton
}
}
override
func
viewWillLayoutSubviews
()
{
override
func
viewWillLayoutSubviews
()
{
...
...
Examples/Programmatic/App/App/RecipesViewController.swift
View file @
1af9a3a2
...
@@ -64,7 +64,7 @@ class RecipesViewController: UIViewController {
...
@@ -64,7 +64,7 @@ class RecipesViewController: UIViewController {
override
func
viewWillAppear
(
animated
:
Bool
)
{
override
func
viewWillAppear
(
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
super
.
viewWillAppear
(
animated
)
// Stops the tableView contentInsets from being automatically adjusted.
// Stops the tableView contentInsets from being automatically adjusted.
automaticallyAdjustsScrollViewInsets
=
fals
e
automaticallyAdjustsScrollViewInsets
=
tru
e
// Set the navigationBar style.
// Set the navigationBar style.
navigationController
?
.
navigationBar
.
statusBarStyle
=
.
LightContent
navigationController
?
.
navigationBar
.
statusBarStyle
=
.
LightContent
...
@@ -73,26 +73,6 @@ class RecipesViewController: UIViewController {
...
@@ -73,26 +73,6 @@ class RecipesViewController: UIViewController {
sideNavigationController
?
.
enabled
=
true
sideNavigationController
?
.
enabled
=
true
}
}
override
func
viewDidAppear
(
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
// Show the menuView.
menuController
?
.
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
translateY
(
0
)
]))
}
override
func
viewWillDisappear
(
animated
:
Bool
)
{
super
.
viewWillDisappear
(
animated
)
// Disable the SideNavigation.
// Hide the menuView.
menuController
?
.
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
translateY
(
150
)
]))
}
/// Handles the menuButton.
/// Handles the menuButton.
internal
func
handleMenuButton
()
{
internal
func
handleMenuButton
()
{
sideNavigationController
?
.
openLeftView
()
sideNavigationController
?
.
openLeftView
()
...
...
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