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
5c193224
Commit
5c193224
authored
Mar 27, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated mainViewController references to rootViewController
parent
30004d7d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
134 additions
and
117 deletions
+134
-117
Examples/Programmatic/App/App/AppDelegate.swift
+2
-2
Examples/Programmatic/App/App/AppNavigationController.swift
+5
-1
Examples/Programmatic/App/App/RecipesViewController.swift
+3
-3
Examples/Programmatic/MenuViewController/MenuViewController/AppDelegate.swift
+1
-1
Examples/Programmatic/MenuViewController/MenuViewController/AppMenuViewController.swift
+11
-11
Examples/Programmatic/SearchBarController/SearchBarController/AppDelegate.swift
+1
-1
Examples/Programmatic/SearchBarController/SearchBarController/AppSearchBarController.swift
+13
-13
Examples/Programmatic/SideNavigationController/SideNavigationController/AppDelegate.swift
+1
-1
Examples/Programmatic/ToolbarController/ToolbarController/AppDelegate.swift
+1
-1
Examples/Programmatic/ToolbarController/ToolbarController/AppToolbarController.swift
+2
-2
Examples/Storyboards/SideNavigationController/SideNavigationController/AppDelegate.swift
+2
-2
Examples/Storyboards/SideNavigationController/SideNavigationController/Base.lproj/Main.storyboard
+4
-7
Examples/Storyboards/SideNavigationController/SideNavigationController/MainViewController.swift
+1
-1
Sources/BottomNavigationController.swift
+9
-4
Sources/Info.plist
+1
-1
Sources/MenuViewController.swift
+34
-30
Sources/NavigationController.swift
+6
-2
Sources/SideNavigationController.swift
+0
-0
Sources/StatusBarViewController.swift
+35
-32
Sources/ToolbarController.swift
+2
-2
No files found.
Examples/Programmatic/App/App/AppDelegate.swift
View file @
5c193224
...
@@ -39,14 +39,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -39,14 +39,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
let
bottomNavigationController
:
BottomNavigationController
=
BottomNavigationController
()
let
bottomNavigationController
:
BottomNavigationController
=
BottomNavigationController
()
bottomNavigationController
.
viewControllers
=
[
AppMenuViewController
(
main
ViewController
:
AppNavigationController
(
rootViewController
:
RecipesViewController
())),
VideoViewController
(),
PhotoViewController
()]
bottomNavigationController
.
viewControllers
=
[
AppMenuViewController
(
root
ViewController
:
AppNavigationController
(
rootViewController
:
RecipesViewController
())),
VideoViewController
(),
PhotoViewController
()]
bottomNavigationController
.
selectedIndex
=
0
bottomNavigationController
.
selectedIndex
=
0
bottomNavigationController
.
tabBar
.
tintColor
=
MaterialColor
.
lightBlue
.
base
bottomNavigationController
.
tabBar
.
tintColor
=
MaterialColor
.
lightBlue
.
base
bottomNavigationController
.
tabBar
.
backgroundColor
=
MaterialColor
.
grey
.
darken4
bottomNavigationController
.
tabBar
.
backgroundColor
=
MaterialColor
.
grey
.
darken4
// Override point for customization after application launch.
// Override point for customization after application launch.
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
!.
rootViewController
=
SideNavigationController
(
main
ViewController
:
bottomNavigationController
,
leftViewController
:
AppLeftViewController
(),
rightViewController
:
AppRightViewController
())
window
!.
rootViewController
=
SideNavigationController
(
root
ViewController
:
bottomNavigationController
,
leftViewController
:
AppLeftViewController
(),
rightViewController
:
AppRightViewController
())
window
!.
makeKeyAndVisible
()
window
!.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Programmatic/App/App/AppNavigationController.swift
View file @
5c193224
...
@@ -34,7 +34,11 @@ import Material
...
@@ -34,7 +34,11 @@ import Material
class
AppNavigationController
:
NavigationController
{
class
AppNavigationController
:
NavigationController
{
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
prepareNavigationBar
()
}
/// Prepares the navigationBar
private
func
prepareNavigationBar
()
{
navigationBar
.
statusBarStyle
=
.
LightContent
navigationBar
.
statusBarStyle
=
.
LightContent
navigationBar
.
tintColor
=
MaterialColor
.
white
navigationBar
.
tintColor
=
MaterialColor
.
white
navigationBar
.
backgroundColor
=
MaterialColor
.
blue
.
base
navigationBar
.
backgroundColor
=
MaterialColor
.
blue
.
base
...
...
Examples/Programmatic/App/App/RecipesViewController.swift
View file @
5c193224
...
@@ -75,7 +75,7 @@ class RecipesViewController: UIViewController {
...
@@ -75,7 +75,7 @@ class RecipesViewController: UIViewController {
// Show the menuView.
// Show the menuView.
menuViewController
?
.
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
menuViewController
?
.
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
translateY
(
0
)
MaterialAnimation
.
translateY
(
0
-
tabBarController
!.
tabBar
.
frame
.
height
)
]))
]))
}
}
...
@@ -87,7 +87,7 @@ class RecipesViewController: UIViewController {
...
@@ -87,7 +87,7 @@ class RecipesViewController: UIViewController {
// Hide the menuView.
// Hide the menuView.
menuViewController
?
.
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
menuViewController
?
.
menuView
.
animate
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
rotate
(
rotation
:
3
),
MaterialAnimation
.
translateY
(
150
)
MaterialAnimation
.
translateY
(
150
+
tabBarController
!.
tabBar
.
frame
.
height
)
]))
]))
}
}
...
@@ -103,7 +103,7 @@ class RecipesViewController: UIViewController {
...
@@ -103,7 +103,7 @@ class RecipesViewController: UIViewController {
recommended
.
append
(
dataSourceItems
[
3
])
recommended
.
append
(
dataSourceItems
[
3
])
recommended
.
append
(
dataSourceItems
[
5
])
recommended
.
append
(
dataSourceItems
[
5
])
let
vc
:
AppSearchBarController
=
AppSearchBarController
(
main
ViewController
:
RecommendationViewController
(
dataSourceItems
:
recommended
))
let
vc
:
AppSearchBarController
=
AppSearchBarController
(
root
ViewController
:
RecommendationViewController
(
dataSourceItems
:
recommended
))
vc
.
modalTransitionStyle
=
.
CrossDissolve
vc
.
modalTransitionStyle
=
.
CrossDissolve
navigationController
?
.
presentViewController
(
vc
,
animated
:
true
,
completion
:
nil
)
navigationController
?
.
presentViewController
(
vc
,
animated
:
true
,
completion
:
nil
)
}
}
...
...
Examples/Programmatic/MenuViewController/MenuViewController/AppDelegate.swift
View file @
5c193224
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
// Override point for customization after application launch.
// Override point for customization after application launch.
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
!.
rootViewController
=
AppMenuViewController
(
main
ViewController
:
YellowViewController
())
window
!.
rootViewController
=
AppMenuViewController
(
root
ViewController
:
YellowViewController
())
window
!.
makeKeyAndVisible
()
window
!.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Programmatic/MenuViewController/MenuViewController/AppMenuViewController.swift
View file @
5c193224
...
@@ -49,46 +49,46 @@ class AppMenuViewController: MenuViewController {
...
@@ -49,46 +49,46 @@ class AppMenuViewController: MenuViewController {
prepareMenuView
()
prepareMenuView
()
}
}
/// Loads the BlueViewController into the menuViewControllers
main
ViewController.
/// Loads the BlueViewController into the menuViewControllers
root
ViewController.
func
handleBlueButton
()
{
func
handleBlueButton
()
{
if
main
ViewController
is
BlueViewController
{
if
root
ViewController
is
BlueViewController
{
return
return
}
}
closeMenu
{
[
weak
self
]
in
closeMenu
{
[
weak
self
]
in
self
?
.
transitionFrom
Main
ViewController
(
BlueViewController
(),
options
:
[
.
TransitionCrossDissolve
])
self
?
.
transitionFrom
Root
ViewController
(
BlueViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
}
}
/// Loads the GreenViewController into the menuViewControllers
main
ViewController.
/// Loads the GreenViewController into the menuViewControllers
root
ViewController.
func
handleGreenButton
()
{
func
handleGreenButton
()
{
if
main
ViewController
is
GreenViewController
{
if
root
ViewController
is
GreenViewController
{
return
return
}
}
closeMenu
{
[
weak
self
]
in
closeMenu
{
[
weak
self
]
in
self
?
.
transitionFrom
Main
ViewController
(
GreenViewController
(),
options
:
[
.
TransitionCrossDissolve
])
self
?
.
transitionFrom
Root
ViewController
(
GreenViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
}
}
/// Loads the YellowViewController into the menuViewControllers
main
ViewController.
/// Loads the YellowViewController into the menuViewControllers
root
ViewController.
func
handleYellowButton
()
{
func
handleYellowButton
()
{
// if (
mainViewController as? ToolbarController)?.main
ViewController is YellowViewController {
// if (
rootViewController as? ToolbarController)?.root
ViewController is YellowViewController {
// return
// return
// }
// }
closeMenu
{
[
weak
self
]
in
closeMenu
{
[
weak
self
]
in
self
?
.
transitionFrom
Main
ViewController
(
YellowViewController
(),
options
:
[
.
TransitionCrossDissolve
])
self
?
.
transitionFrom
Root
ViewController
(
YellowViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
}
}
/// Handle the menuView touch event.
/// Handle the menuView touch event.
func
handleMenu
()
{
func
handleMenu
()
{
if
menuView
.
menu
.
opened
{
if
menuView
.
menu
.
opened
{
menuViewController
?
.
main
ViewController
.
view
.
alpha
=
1
menuViewController
?
.
root
ViewController
.
view
.
alpha
=
1
closeMenu
()
closeMenu
()
}
else
{
}
else
{
menuViewController
?
.
main
ViewController
.
view
.
alpha
=
0.5
menuViewController
?
.
root
ViewController
.
view
.
alpha
=
0.5
openMenu
()
openMenu
()
}
}
}
}
...
...
Examples/Programmatic/SearchBarController/SearchBarController/AppDelegate.swift
View file @
5c193224
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
// Override point for customization after application launch.
// Override point for customization after application launch.
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
!.
rootViewController
=
AppSearchBarController
(
main
ViewController
:
YellowViewController
())
window
!.
rootViewController
=
AppSearchBarController
(
root
ViewController
:
YellowViewController
())
window
!.
makeKeyAndVisible
()
window
!.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Programmatic/SearchBarController/SearchBarController/AppSearchBarController.swift
View file @
5c193224
...
@@ -43,28 +43,28 @@ class AppSearchBarController: SearchBarController {
...
@@ -43,28 +43,28 @@ class AppSearchBarController: SearchBarController {
prepareSearchBar
()
prepareSearchBar
()
}
}
/// Loads the BlueViewController into the searchBarControllers
main
ViewController.
/// Loads the BlueViewController into the searchBarControllers
root
ViewController.
func
handleBlueButton
()
{
func
handleBlueButton
()
{
if
main
ViewController
is
BlueViewController
{
if
root
ViewController
is
BlueViewController
{
return
return
}
}
transitionFrom
Main
ViewController
(
BlueViewController
(),
options
:
[
.
TransitionCrossDissolve
])
transitionFrom
Root
ViewController
(
BlueViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
/// Loads the GreenViewController into the searchBarControllers
main
ViewController.
/// Loads the GreenViewController into the searchBarControllers
root
ViewController.
func
handleGreenButton
()
{
func
handleGreenButton
()
{
if
main
ViewController
is
GreenViewController
{
if
root
ViewController
is
GreenViewController
{
return
return
}
}
transitionFrom
Main
ViewController
(
GreenViewController
(),
options
:
[
.
TransitionCrossDissolve
])
transitionFrom
Root
ViewController
(
GreenViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
/// Loads the YellowViewController into the searchBarControllers
main
ViewController.
/// Loads the YellowViewController into the searchBarControllers
root
ViewController.
func
handleYellowButton
()
{
func
handleYellowButton
()
{
if
(
mainViewController
as?
ToolbarController
)?
.
main
ViewController
is
YellowViewController
{
if
(
rootViewController
as?
ToolbarController
)?
.
root
ViewController
is
YellowViewController
{
return
return
}
}
transitionFrom
Main
ViewController
(
YellowViewController
(),
options
:
[
.
TransitionCrossDissolve
])
transitionFrom
Root
ViewController
(
YellowViewController
(),
options
:
[
.
TransitionCrossDissolve
])
searchBar
.
textField
.
resignFirstResponder
()
searchBar
.
textField
.
resignFirstResponder
()
}
}
...
@@ -128,12 +128,12 @@ class AppSearchBarController: SearchBarController {
...
@@ -128,12 +128,12 @@ class AppSearchBarController: SearchBarController {
extension
AppSearchBarController
:
TextFieldDelegate
{
extension
AppSearchBarController
:
TextFieldDelegate
{
func
textFieldDidBeginEditing
(
textField
:
UITextField
)
{
func
textFieldDidBeginEditing
(
textField
:
UITextField
)
{
main
ViewController
.
view
.
alpha
=
0.5
root
ViewController
.
view
.
alpha
=
0.5
main
ViewController
.
view
.
userInteractionEnabled
=
false
root
ViewController
.
view
.
userInteractionEnabled
=
false
}
}
func
textFieldDidEndEditing
(
textField
:
UITextField
)
{
func
textFieldDidEndEditing
(
textField
:
UITextField
)
{
main
ViewController
.
view
.
alpha
=
1
root
ViewController
.
view
.
alpha
=
1
main
ViewController
.
view
.
userInteractionEnabled
=
true
root
ViewController
.
view
.
userInteractionEnabled
=
true
}
}
}
}
Examples/Programmatic/SideNavigationController/SideNavigationController/AppDelegate.swift
View file @
5c193224
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
// Override point for customization after application launch.
// Override point for customization after application launch.
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
!.
rootViewController
=
SideNavigationController
(
main
ViewController
:
YellowViewController
(),
leftViewController
:
GreenViewController
(),
rightViewController
:
BlueViewController
())
window
!.
rootViewController
=
SideNavigationController
(
root
ViewController
:
YellowViewController
(),
leftViewController
:
GreenViewController
(),
rightViewController
:
BlueViewController
())
window
!.
makeKeyAndVisible
()
window
!.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Programmatic/ToolbarController/ToolbarController/AppDelegate.swift
View file @
5c193224
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
// Override point for customization after application launch.
// Override point for customization after application launch.
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
!.
rootViewController
=
AppToolbarController
(
main
ViewController
:
YellowViewController
())
window
!.
rootViewController
=
AppToolbarController
(
root
ViewController
:
YellowViewController
())
window
!.
makeKeyAndVisible
()
window
!.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Programmatic/ToolbarController/ToolbarController/AppToolbarController.swift
View file @
5c193224
...
@@ -61,7 +61,7 @@ class AppToolbarController: ToolbarController {
...
@@ -61,7 +61,7 @@ class AppToolbarController: ToolbarController {
/// Toggle SideNavigationController left UIViewController.
/// Toggle SideNavigationController left UIViewController.
internal
func
handleMenuButton
()
{
internal
func
handleMenuButton
()
{
transitionFrom
Main
ViewController
(
GreenViewController
(),
options
:
[
.
TransitionCrossDissolve
])
transitionFrom
Root
ViewController
(
GreenViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
/// Toggle SideNavigationController right UIViewController.
/// Toggle SideNavigationController right UIViewController.
...
@@ -125,7 +125,7 @@ class AppToolbarController: ToolbarController {
...
@@ -125,7 +125,7 @@ class AppToolbarController: ToolbarController {
extension
AppToolbarController
:
MaterialSwitchDelegate
{
extension
AppToolbarController
:
MaterialSwitchDelegate
{
func
materialSwitchStateChanged
(
control
:
MaterialSwitch
)
{
func
materialSwitchStateChanged
(
control
:
MaterialSwitch
)
{
transitionFrom
Main
ViewController
(
YellowViewController
(),
options
:
[
.
TransitionCrossDissolve
])
transitionFrom
Root
ViewController
(
YellowViewController
(),
options
:
[
.
TransitionCrossDissolve
])
}
}
}
}
Examples/Storyboards/SideNavigationController/SideNavigationController/AppDelegate.swift
View file @
5c193224
...
@@ -40,12 +40,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -40,12 +40,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
// Get view controllers from storyboard
// Get view controllers from storyboard
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
nil
)
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
nil
)
let
mainViewController
=
storyboard
.
instantiateViewControllerWithIdentifier
(
"MainViewController"
)
as!
Main
ViewController
let
rootViewController
=
storyboard
.
instantiateViewControllerWithIdentifier
(
"RootViewController"
)
as!
Root
ViewController
let
sideViewController
=
storyboard
.
instantiateViewControllerWithIdentifier
(
"SideViewController"
)
as!
SideViewController
let
sideViewController
=
storyboard
.
instantiateViewControllerWithIdentifier
(
"SideViewController"
)
as!
SideViewController
// Configure the window with the SideNavigationController as the root view controller
// Configure the window with the SideNavigationController as the root view controller
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
?
.
rootViewController
=
SideNavigationController
(
mainViewController
:
main
ViewController
,
leftViewController
:
sideViewController
)
window
?
.
rootViewController
=
SideNavigationController
(
rootViewController
:
root
ViewController
,
leftViewController
:
sideViewController
)
window
?
.
makeKeyAndVisible
()
window
?
.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Storyboards/SideNavigationController/SideNavigationController/Base.lproj/Main.storyboard
View file @
5c193224
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"
9060"
systemVersion=
"15B42
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"
10116"
systemVersion=
"15D21
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
>
<dependencies>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"10085"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"9051"
/>
</dependencies>
</dependencies>
<scenes>
<scenes>
<!--
Main
View Controller-->
<!--
Root
View Controller-->
<scene
sceneID=
"S32-pp-djU"
>
<scene
sceneID=
"S32-pp-djU"
>
<objects>
<objects>
<viewController
storyboardIdentifier=
"
MainViewController"
useStoryboardIdentifierAsRestorationIdentifier=
"YES"
id=
"huh-WT-4zU"
customClass=
"Main
ViewController"
customModule=
"SideNavigationViewController"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<viewController
storyboardIdentifier=
"
RootViewController"
useStoryboardIdentifierAsRestorationIdentifier=
"YES"
id=
"huh-WT-4zU"
customClass=
"Root
ViewController"
customModule=
"SideNavigationViewController"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<layoutGuides>
<layoutGuides>
<viewControllerLayoutGuide
type=
"top"
id=
"778-lO-FMj"
/>
<viewControllerLayoutGuide
type=
"top"
id=
"778-lO-FMj"
/>
<viewControllerLayoutGuide
type=
"bottom"
id=
"hvu-kv-aLI"
/>
<viewControllerLayoutGuide
type=
"bottom"
id=
"hvu-kv-aLI"
/>
...
@@ -16,7 +15,6 @@
...
@@ -16,7 +15,6 @@
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"I6q-Is-0pO"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"I6q-Is-0pO"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"600"
height=
"600"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"600"
height=
"600"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<animations/>
<color
key=
"backgroundColor"
red=
"0.3590823447"
green=
"0.30467909450000003"
blue=
"0.81552683250000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"backgroundColor"
red=
"0.3590823447"
green=
"0.30467909450000003"
blue=
"0.81552683250000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</view>
</view>
</viewController>
</viewController>
...
@@ -35,7 +33,6 @@
...
@@ -35,7 +33,6 @@
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"8bC-Xf-vdC"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"8bC-Xf-vdC"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"600"
height=
"600"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"600"
height=
"600"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<animations/>
<color
key=
"backgroundColor"
red=
"0.93725490199999995"
green=
"0.93725490199999995"
blue=
"0.95686274510000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"backgroundColor"
red=
"0.93725490199999995"
green=
"0.93725490199999995"
blue=
"0.95686274510000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</view>
</view>
</viewController>
</viewController>
...
...
Examples/Storyboards/SideNavigationController/SideNavigationController/MainViewController.swift
View file @
5c193224
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
import
UIKit
import
UIKit
import
Material
import
Material
class
Main
ViewController
:
UIViewController
{
class
Root
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
// Do any additional setup after loading the view, typically from a nib.
// Do any additional setup after loading the view, typically from a nib.
...
...
Sources/BottomNavigationController.swift
View file @
5c193224
...
@@ -112,14 +112,19 @@ public class BottomNavigationController : UITabBarController, UITabBarController
...
@@ -112,14 +112,19 @@ public class BottomNavigationController : UITabBarController, UITabBarController
public
func
prepareView
()
{
public
func
prepareView
()
{
view
.
clipsToBounds
=
true
view
.
clipsToBounds
=
true
delegate
=
self
delegate
=
self
tabBar
.
depth
=
.
Depth1
prepareTabBar
()
tabBar
.
backgroundColor
=
MaterialColor
.
white
tabBar
.
shadowImage
=
UIImage
.
imageWithColor
(
MaterialColor
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
tabBar
.
backgroundImage
=
UIImage
()
}
}
/// Handles transitions when tabBarItems are pressed.
/// Handles transitions when tabBarItems are pressed.
public
func
tabBarController
(
tabBarController
:
UITabBarController
,
animationControllerForTransitionFromViewController
fromVC
:
UIViewController
,
toViewController
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
public
func
tabBarController
(
tabBarController
:
UITabBarController
,
animationControllerForTransitionFromViewController
fromVC
:
UIViewController
,
toViewController
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
.
Fade
==
transitionAnimation
?
BottomNavigationFadeAnimatedTransitioning
()
:
nil
return
.
Fade
==
transitionAnimation
?
BottomNavigationFadeAnimatedTransitioning
()
:
nil
}
}
/// Prepares the tabBar.
private
func
prepareTabBar
()
{
tabBar
.
depth
=
.
Depth1
tabBar
.
backgroundColor
=
MaterialColor
.
white
tabBar
.
shadowImage
=
UIImage
.
imageWithColor
(
MaterialColor
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
tabBar
.
backgroundImage
=
UIImage
()
}
}
}
Sources/Info.plist
View file @
5c193224
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.3
7.3
<
/string
>
<
string
>
1.3
8.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
Sources/MenuViewController.swift
View file @
5c193224
...
@@ -55,32 +55,32 @@ public class MenuViewController : UIViewController {
...
@@ -55,32 +55,32 @@ public class MenuViewController : UIViewController {
/**
/**
A Boolean property used to enable and disable interactivity
A Boolean property used to enable and disable interactivity
with the
main
ViewController.
with the
root
ViewController.
*/
*/
@IBInspectable
public
var
userInteractionEnabled
:
Bool
{
@IBInspectable
public
var
userInteractionEnabled
:
Bool
{
get
{
get
{
return
main
ViewController
.
view
.
userInteractionEnabled
return
root
ViewController
.
view
.
userInteractionEnabled
}
}
set
(
value
)
{
set
(
value
)
{
main
ViewController
.
view
.
userInteractionEnabled
=
value
root
ViewController
.
view
.
userInteractionEnabled
=
value
}
}
}
}
/**
/**
A UIViewController property that references the active
A UIViewController property that references the active
main UIViewController. To swap the
main
ViewController, it
main UIViewController. To swap the
root
ViewController, it
is recommended to use the transitionFrom
Main
ViewController
is recommended to use the transitionFrom
Root
ViewController
helper method.
helper method.
*/
*/
public
private(set)
var
main
ViewController
:
UIViewController
!
public
private(set)
var
root
ViewController
:
UIViewController
!
/**
/**
An initializer for the MenuViewController.
An initializer for the MenuViewController.
- Parameter
main
ViewController: The main UIViewController.
- Parameter
root
ViewController: The main UIViewController.
*/
*/
public
convenience
init
(
main
ViewController
:
UIViewController
)
{
public
convenience
init
(
root
ViewController
:
UIViewController
)
{
self
.
init
()
self
.
init
()
self
.
mainViewController
=
main
ViewController
self
.
rootViewController
=
root
ViewController
prepareView
()
prepareView
()
}
}
...
@@ -90,35 +90,37 @@ public class MenuViewController : UIViewController {
...
@@ -90,35 +90,37 @@ public class MenuViewController : UIViewController {
}
}
/**
/**
A method to swap
main
ViewController objects.
A method to swap
root
ViewController objects.
- Parameter toViewController: The UIViewController to swap
- Parameter toViewController: The UIViewController to swap
with the active
main
ViewController.
with the active
root
ViewController.
- Parameter duration: A NSTimeInterval that sets the
- Parameter duration: A NSTimeInterval that sets the
animation duration of the transition.
animation duration of the transition.
- Parameter options: UIViewAnimationOptions thst are used
- Parameter options: UIViewAnimationOptions thst are used
when animating the transition from the active
main
ViewController
when animating the transition from the active
root
ViewController
to the toViewController.
to the toViewController.
- Parameter animations: An animation block that is executed during
- Parameter animations: An animation block that is executed during
the transition from the active
main
ViewController
the transition from the active
root
ViewController
to the toViewController.
to the toViewController.
- Parameter completion: A completion block that is execited after
- Parameter completion: A completion block that is execited after
the transition animation from the active
main
ViewController
the transition animation from the active
root
ViewController
to the toViewController has completed.
to the toViewController has completed.
*/
*/
public
func
transitionFrom
Main
ViewController
(
toViewController
:
UIViewController
,
duration
:
NSTimeInterval
=
0.5
,
options
:
UIViewAnimationOptions
=
[],
animations
:
(()
->
Void
)?
=
nil
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
public
func
transitionFrom
Root
ViewController
(
toViewController
:
UIViewController
,
duration
:
NSTimeInterval
=
0.5
,
options
:
UIViewAnimationOptions
=
[],
animations
:
(()
->
Void
)?
=
nil
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
main
ViewController
.
willMoveToParentViewController
(
nil
)
root
ViewController
.
willMoveToParentViewController
(
nil
)
addChildViewController
(
toViewController
)
addChildViewController
(
toViewController
)
toViewController
.
view
.
frame
=
main
ViewController
.
view
.
frame
toViewController
.
view
.
frame
=
root
ViewController
.
view
.
frame
transitionFromViewController
(
main
ViewController
,
transitionFromViewController
(
root
ViewController
,
toViewController
:
toViewController
,
toViewController
:
toViewController
,
duration
:
duration
,
duration
:
duration
,
options
:
options
,
options
:
options
,
animations
:
animations
,
animations
:
animations
,
completion
:
{
[
unowned
self
]
(
result
:
Bool
)
in
completion
:
{
[
unowned
self
]
(
result
:
Bool
)
in
toViewController
.
didMoveToParentViewController
(
self
)
toViewController
.
didMoveToParentViewController
(
self
)
self
.
mainViewController
.
removeFromParentViewController
()
self
.
rootViewController
.
removeFromParentViewController
()
self
.
mainViewController
=
toViewController
self
.
rootViewController
=
toViewController
self
.
view
.
sendSubviewToBack
(
self
.
mainViewController
.
view
)
self
.
rootViewController
.
view
.
clipsToBounds
=
true
self
.
rootViewController
.
view
.
autoresizingMask
=
.
FlexibleWidth
self
.
view
.
sendSubviewToBack
(
self
.
rootViewController
.
view
)
completion
?(
result
)
completion
?(
result
)
})
})
}
}
...
@@ -131,7 +133,7 @@ public class MenuViewController : UIViewController {
...
@@ -131,7 +133,7 @@ public class MenuViewController : UIViewController {
public
func
openMenu
(
completion
:
(()
->
Void
)?
=
nil
)
{
public
func
openMenu
(
completion
:
(()
->
Void
)?
=
nil
)
{
if
true
==
userInteractionEnabled
{
if
true
==
userInteractionEnabled
{
userInteractionEnabled
=
false
userInteractionEnabled
=
false
main
ViewController
.
view
.
alpha
=
0.5
root
ViewController
.
view
.
alpha
=
0.5
menuView
.
open
(
completion
)
menuView
.
open
(
completion
)
}
}
}
}
...
@@ -143,7 +145,7 @@ public class MenuViewController : UIViewController {
...
@@ -143,7 +145,7 @@ public class MenuViewController : UIViewController {
*/
*/
public
func
closeMenu
(
completion
:
(()
->
Void
)?
=
nil
)
{
public
func
closeMenu
(
completion
:
(()
->
Void
)?
=
nil
)
{
if
false
==
userInteractionEnabled
{
if
false
==
userInteractionEnabled
{
main
ViewController
.
view
.
alpha
=
1
root
ViewController
.
view
.
alpha
=
1
menuView
.
close
({
[
weak
self
]
in
menuView
.
close
({
[
weak
self
]
in
self
?
.
userInteractionEnabled
=
true
self
?
.
userInteractionEnabled
=
true
completion
?()
completion
?()
...
@@ -153,10 +155,9 @@ public class MenuViewController : UIViewController {
...
@@ -153,10 +155,9 @@ public class MenuViewController : UIViewController {
/// A method that generally prepares the MenuViewController.
/// A method that generally prepares the MenuViewController.
private
func
prepareView
()
{
private
func
prepareView
()
{
edgesForExtendedLayout
=
.
None
view
.
clipsToBounds
=
true
view
.
clipsToBounds
=
true
prepareMenuView
()
prepareMenuView
()
prepare
Main
ViewController
()
prepare
Root
ViewController
()
}
}
/// Prepares the MenuView.
/// Prepares the MenuView.
...
@@ -165,9 +166,11 @@ public class MenuViewController : UIViewController {
...
@@ -165,9 +166,11 @@ public class MenuViewController : UIViewController {
view
.
addSubview
(
menuView
)
view
.
addSubview
(
menuView
)
}
}
/// A method that prepares the mainViewController.
/// A method that prepares the rootViewController.
private
func
prepareMainViewController
()
{
private
func
prepareRootViewController
()
{
prepareViewControllerWithinContainer
(
mainViewController
,
container
:
view
)
rootViewController
.
view
.
clipsToBounds
=
true
rootViewController
.
view
.
autoresizingMask
=
.
FlexibleWidth
prepareViewControllerWithinContainer
(
rootViewController
,
container
:
view
)
}
}
/**
/**
...
@@ -181,13 +184,14 @@ public class MenuViewController : UIViewController {
...
@@ -181,13 +184,14 @@ public class MenuViewController : UIViewController {
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
if
let
v
:
UIViewController
=
viewController
{
if
let
v
:
UIViewController
=
viewController
{
addChildViewController
(
v
)
addChildViewController
(
v
)
container
.
insertSubview
(
v
.
view
,
atIndex
:
0
)
container
.
addSubview
(
v
.
view
)
container
.
sendSubviewToBack
(
v
.
view
)
v
.
didMoveToParentViewController
(
self
)
v
.
didMoveToParentViewController
(
self
)
}
}
}
}
/// Layout subviews.
/// Layout subviews.
private
func
layoutSubviews
()
{
private
func
layoutSubviews
()
{
main
ViewController
.
view
.
frame
=
view
.
bounds
root
ViewController
.
view
.
frame
=
view
.
bounds
}
}
}
}
Sources/NavigationController.swift
View file @
5c193224
...
@@ -60,8 +60,7 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
...
@@ -60,8 +60,7 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
public
override
func
viewDidLoad
()
{
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
edgesForExtendedLayout
=
.
None
prepareView
()
view
.
clipsToBounds
=
true
// This ensures the panning gesture is available when going back between views.
// This ensures the panning gesture is available when going back between views.
if
let
v
:
UIGestureRecognizer
=
interactivePopGestureRecognizer
{
if
let
v
:
UIGestureRecognizer
=
interactivePopGestureRecognizer
{
...
@@ -128,4 +127,9 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
...
@@ -128,4 +127,9 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
internal
func
handleBackButton
()
{
internal
func
handleBackButton
()
{
popViewControllerAnimated
(
true
)
popViewControllerAnimated
(
true
)
}
}
/// Prepares the view.
private
func
prepareView
()
{
view
.
clipsToBounds
=
true
}
}
}
Sources/SideNavigationController.swift
View file @
5c193224
This diff is collapsed.
Click to expand it.
Sources/StatusBarViewController.swift
View file @
5c193224
...
@@ -43,65 +43,67 @@ public class StatusBarViewController : UIViewController {
...
@@ -43,65 +43,67 @@ public class StatusBarViewController : UIViewController {
/**
/**
A Boolean property used to enable and disable interactivity
A Boolean property used to enable and disable interactivity
with the
main
ViewController.
with the
root
ViewController.
*/
*/
@IBInspectable
public
var
userInteractionEnabled
:
Bool
{
@IBInspectable
public
var
userInteractionEnabled
:
Bool
{
get
{
get
{
return
main
ViewController
.
view
.
userInteractionEnabled
return
root
ViewController
.
view
.
userInteractionEnabled
}
}
set
(
value
)
{
set
(
value
)
{
main
ViewController
.
view
.
userInteractionEnabled
=
value
root
ViewController
.
view
.
userInteractionEnabled
=
value
}
}
}
}
/**
/**
A UIViewController property that references the active
A UIViewController property that references the active
main UIViewController. To swap the
main
ViewController, it
main UIViewController. To swap the
root
ViewController, it
is recommended to use the transitionFrom
Main
ViewController
is recommended to use the transitionFrom
Root
ViewController
helper method.
helper method.
*/
*/
public
private(set)
var
main
ViewController
:
UIViewController
!
public
private(set)
var
root
ViewController
:
UIViewController
!
/**
/**
An initializer for the StatusBarViewController.
An initializer for the StatusBarViewController.
- Parameter
main
ViewController: The main UIViewController.
- Parameter
root
ViewController: The main UIViewController.
*/
*/
public
convenience
init
(
main
ViewController
:
UIViewController
)
{
public
convenience
init
(
root
ViewController
:
UIViewController
)
{
self
.
init
()
self
.
init
()
self
.
mainViewController
=
main
ViewController
self
.
rootViewController
=
root
ViewController
prepareView
()
prepareView
()
}
}
/**
/**
A method to swap
main
ViewController objects.
A method to swap
root
ViewController objects.
- Parameter toViewController: The UIViewController to swap
- Parameter toViewController: The UIViewController to swap
with the active
main
ViewController.
with the active
root
ViewController.
- Parameter duration: A NSTimeInterval that sets the
- Parameter duration: A NSTimeInterval that sets the
animation duration of the transition.
animation duration of the transition.
- Parameter options: UIViewAnimationOptions thst are used
- Parameter options: UIViewAnimationOptions thst are used
when animating the transition from the active
main
ViewController
when animating the transition from the active
root
ViewController
to the toViewController.
to the toViewController.
- Parameter animations: An animation block that is executed during
- Parameter animations: An animation block that is executed during
the transition from the active
main
ViewController
the transition from the active
root
ViewController
to the toViewController.
to the toViewController.
- Parameter completion: A completion block that is execited after
- Parameter completion: A completion block that is execited after
the transition animation from the active
main
ViewController
the transition animation from the active
root
ViewController
to the toViewController has completed.
to the toViewController has completed.
*/
*/
public
func
transitionFrom
Main
ViewController
(
toViewController
:
UIViewController
,
duration
:
NSTimeInterval
=
0.5
,
options
:
UIViewAnimationOptions
=
[],
animations
:
(()
->
Void
)?
=
nil
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
public
func
transitionFrom
Root
ViewController
(
toViewController
:
UIViewController
,
duration
:
NSTimeInterval
=
0.5
,
options
:
UIViewAnimationOptions
=
[],
animations
:
(()
->
Void
)?
=
nil
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
main
ViewController
.
willMoveToParentViewController
(
nil
)
root
ViewController
.
willMoveToParentViewController
(
nil
)
addChildViewController
(
toViewController
)
addChildViewController
(
toViewController
)
toViewController
.
view
.
frame
=
main
ViewController
.
view
.
frame
toViewController
.
view
.
frame
=
root
ViewController
.
view
.
frame
transitionFromViewController
(
main
ViewController
,
transitionFromViewController
(
root
ViewController
,
toViewController
:
toViewController
,
toViewController
:
toViewController
,
duration
:
duration
,
duration
:
duration
,
options
:
options
,
options
:
options
,
animations
:
animations
,
animations
:
animations
,
completion
:
{
[
unowned
self
]
(
result
:
Bool
)
in
completion
:
{
[
unowned
self
]
(
result
:
Bool
)
in
toViewController
.
didMoveToParentViewController
(
self
)
toViewController
.
didMoveToParentViewController
(
self
)
self
.
mainViewController
.
removeFromParentViewController
()
self
.
rootViewController
.
removeFromParentViewController
()
self
.
mainViewController
=
toViewController
self
.
rootViewController
=
toViewController
self
.
view
.
sendSubviewToBack
(
self
.
mainViewController
.
view
)
self
.
rootViewController
.
view
.
clipsToBounds
=
true
self
.
rootViewController
.
view
.
autoresizingMask
=
.
FlexibleWidth
self
.
view
.
sendSubviewToBack
(
self
.
rootViewController
.
view
)
completion
?(
result
)
completion
?(
result
)
})
})
}
}
...
@@ -114,9 +116,8 @@ public class StatusBarViewController : UIViewController {
...
@@ -114,9 +116,8 @@ public class StatusBarViewController : UIViewController {
when subclassing.
when subclassing.
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
edgesForExtendedLayout
=
.
None
view
.
clipsToBounds
=
true
view
.
clipsToBounds
=
true
prepare
Main
ViewController
()
prepare
Root
ViewController
()
}
}
public
override
func
viewWillLayoutSubviews
()
{
public
override
func
viewWillLayoutSubviews
()
{
...
@@ -130,18 +131,19 @@ public class StatusBarViewController : UIViewController {
...
@@ -130,18 +131,19 @@ public class StatusBarViewController : UIViewController {
let
q
:
CGFloat
=
UIApplication
.
sharedApplication
()
.
statusBarFrame
.
size
.
height
let
q
:
CGFloat
=
UIApplication
.
sharedApplication
()
.
statusBarFrame
.
size
.
height
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
landscape
{
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
landscape
{
main
ViewController
.
view
.
frame
.
origin
.
y
=
heightForLandscapeOrientation
root
ViewController
.
view
.
frame
.
origin
.
y
=
heightForLandscapeOrientation
main
ViewController
.
view
.
frame
.
size
.
height
=
h
-
(
heightForStatusBar
>=
q
?
heightForLandscapeOrientation
:
q
-
heightForStatusBar
-
heightForLandscapeOrientation
)
root
ViewController
.
view
.
frame
.
size
.
height
=
h
-
(
heightForStatusBar
>=
q
?
heightForLandscapeOrientation
:
q
-
heightForStatusBar
-
heightForLandscapeOrientation
)
}
else
{
}
else
{
main
ViewController
.
view
.
frame
.
origin
.
y
=
heightForPortraitOrientation
root
ViewController
.
view
.
frame
.
origin
.
y
=
heightForPortraitOrientation
main
ViewController
.
view
.
frame
.
size
.
height
=
h
-
(
heightForStatusBar
>=
q
?
heightForPortraitOrientation
:
q
-
heightForStatusBar
-
heightForPortraitOrientation
)
root
ViewController
.
view
.
frame
.
size
.
height
=
h
-
(
heightForStatusBar
>=
q
?
heightForPortraitOrientation
:
q
-
heightForStatusBar
-
heightForPortraitOrientation
)
}
}
}
}
/// A method that prepares the mainViewController.
/// A method that prepares the rootViewController.
private
func
prepareMainViewController
()
{
private
func
prepareRootViewController
()
{
mainViewController
.
view
.
autoresizingMask
=
.
FlexibleWidth
rootViewController
.
view
.
clipsToBounds
=
true
prepareViewControllerWithinContainer
(
mainViewController
,
container
:
view
)
rootViewController
.
view
.
autoresizingMask
=
.
FlexibleWidth
prepareViewControllerWithinContainer
(
rootViewController
,
container
:
view
)
}
}
/**
/**
...
@@ -155,7 +157,8 @@ public class StatusBarViewController : UIViewController {
...
@@ -155,7 +157,8 @@ public class StatusBarViewController : UIViewController {
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
if
let
v
:
UIViewController
=
viewController
{
if
let
v
:
UIViewController
=
viewController
{
addChildViewController
(
v
)
addChildViewController
(
v
)
container
.
insertSubview
(
v
.
view
,
atIndex
:
0
)
container
.
addSubview
(
v
.
view
)
container
.
sendSubviewToBack
(
v
.
view
)
v
.
didMoveToParentViewController
(
self
)
v
.
didMoveToParentViewController
(
self
)
}
}
}
}
...
...
Sources/ToolbarController.swift
View file @
5c193224
...
@@ -119,7 +119,7 @@ public class ToolbarController : StatusBarViewController {
...
@@ -119,7 +119,7 @@ public class ToolbarController : StatusBarViewController {
animations
:
{
[
unowned
self
]
in
animations
:
{
[
unowned
self
]
in
v
.
view
.
center
.
y
=
2
*
self
.
view
.
bounds
.
height
v
.
view
.
center
.
y
=
2
*
self
.
view
.
bounds
.
height
self
.
toolbar
.
alpha
=
1
self
.
toolbar
.
alpha
=
1
self
.
main
ViewController
.
view
.
alpha
=
1
self
.
root
ViewController
.
view
.
alpha
=
1
})
{
[
unowned
self
]
_
in
})
{
[
unowned
self
]
_
in
v
.
willMoveToParentViewController
(
nil
)
v
.
willMoveToParentViewController
(
nil
)
v
.
view
.
removeFromSuperview
()
v
.
view
.
removeFromSuperview
()
...
@@ -157,7 +157,7 @@ public class ToolbarController : StatusBarViewController {
...
@@ -157,7 +157,7 @@ public class ToolbarController : StatusBarViewController {
animations
:
{
[
unowned
self
]
in
animations
:
{
[
unowned
self
]
in
v
.
view
.
center
.
y
=
self
.
view
.
bounds
.
height
/
2
v
.
view
.
center
.
y
=
self
.
view
.
bounds
.
height
/
2
self
.
toolbar
.
alpha
=
0.5
self
.
toolbar
.
alpha
=
0.5
self
.
main
ViewController
.
view
.
alpha
=
0.5
self
.
root
ViewController
.
view
.
alpha
=
0.5
})
{
[
unowned
self
]
_
in
})
{
[
unowned
self
]
_
in
v
.
view
.
layer
.
shouldRasterize
=
false
v
.
view
.
layer
.
shouldRasterize
=
false
self
.
view
.
layer
.
shouldRasterize
=
false
self
.
view
.
layer
.
shouldRasterize
=
false
...
...
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